简体   繁体   中英

Why is Access Dlookup Formula Giving Compile Error

so here's my problem. The below works:

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","WorkOrder=331091")

Unfortunately I need 331091 to be Combo4. Once I change the formula to:

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","WorkOrder"= [Combo4]") or

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","WorkOrder"= Combo4) or

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","[WorkOrder]"= [Combo4])

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","[WorkOrder]= [Combo4]")

I've been testing all the variations in Immediate Window and all result in Compile error: Expected: expression. Getting the same error in my other database which is why I created this one. One table, one record along with one unbound form. Table has WorkOrder and CylindersCompleted which are both Number and the form has one Combo and one textbox which are both Number. I'm putting the Dlookup formula in the Control Source of the textbox. I'm hoping someone can help me solve this issue so I can apply it to my other database which is much more complicated. Thanks in advance.

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","WorkOrder"= [Combo4]")

Should be:

=DLookUp("[CylindersCompleted]","WO_User_Input_Save","WorkOrder=" & [Combo4])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM