Home > Blockchain >  Why is Access Dlookup Formula Giving Compile Error
Why is Access Dlookup Formula Giving Compile Error

Time:03-18

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.

CodePudding user response:

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

Should be:

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