访问DLookUp返回Null

时间:2018-08-13 16:00:01

标签: vba ms-access

我一直到处寻找,似乎找不到答案。我跟踪了在网上找到的其他示例代码的示例,但是没有任何效果。 我试图从数据库查询中的特定单元格中获取一串注释,并将其添加到同一数据库中表单的文本框中。我收到了错误13不匹配错误和96?空错误。下面是我的代码:

class SystemRoleTemplatesContainer extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            isLoading: false,
            permissionList: [],
            roleTemplateList: [],
            permissionsGroup: []
        };
    }

    componentDidMount = () => {
        this.getTableData();
    }

    getTableData = () => {
        store.dispatch(api.getRoletemplates()).then((result) => {
            const permissionHeader = [{
                Header: "Permissions",
                accessor: "permission"
            }]
            const roleTemplateItems = result.body.data.map((data) => {
                return {
                    id: data.relationships.permissions.data.map((data)=>{
                        return {
                            id: data.id
                        }
                     }),
                    Header: data.attributes.name,
                    accessor: data.attributes.name.replace(/\s/g, '')              
                }
            });
            const roleTemplate = permissionHeader.concat(roleTemplateItems)
            this.setState(() => ({
                "roleTemplateList": roleTemplate
            }));             
        });     
        store.dispatch(api.getPermissions()).then((result) => {
            const permissionItems = result.body.data.map((data) => {
                return {
                    id: data.id,
                    permission: data.attributes.name
                }
            });
            
            this.setState(() => ({
                "permissionList": permissionItems
            })); 
        });  
    }

    render() {
        const {isLoading,roleTemplateList, permissionList} = this.state;

        if (isLoading) {
            return <LoadingAnimation />;
        }

        
        return (
            <div className="role-management-form">
                <div className="admin-user-container-title">
                    <Row>
                        <Col md={8}>
                            <h3>Manage Roles Template for System</h3>
                        </Col>
                    </Row>
                </div>                
                <Table
                    columns={roleTemplateList}
                    className="organization-tbl"
                    data={permissionList}
                    defaultPageSize={50}
                    minRows={0}
                />
                
            </div>
        );
    }
}

2 个答案:

答案 0 :(得分:1)

问题是无法找到任何内容的返回值Null无法存储为String,因此您必须将Remarks757声明为{{1 }}

Variant

答案 1 :(得分:1)

VBA And运算符可用于数字表达式,例如“即时”窗口中的这些示例...

? True And True
True
? True And  False
False
? 1 And 2
 0 
? 1 And 3
 1 

但是要求And对字符串进行操作会触发错误#13:“类型不匹配” ...

? "foo" And "bar"

现在看看您要提交给DLookup的第三个参数。

"[YrRated] = Forms![FormDataEntryPave]![TextYrRated]" And "[RdSecNo] = Forms![FormDataEntryPave]![TextRdSecNo]"

这等于一个字符串And另一个字符串,这会触发类型不匹配。通过将所有字符都设为一个字符串来消除错误...

"[YrRated] = Forms![FormDataEntryPave]![TextYrRated] And [RdSecNo] = Forms![FormDataEntryPave]![TextRdSecNo]"