Hi,
I receive an error when I use the DLookup function in a form: "Run-time error '3075': Syntax error (missing operator) in query expression 'id_Item=16ERG60BMA'". 16ERG60BMA is the ID for the item. The code I have setup for this is:
Code:
Private Sub textItemID_AfterUpdate()
textItemDescription = DLookup("item_Description", "table_Items", "id_Item=" & id_Item)
End Sub
I am not sure what is missing or going wrong. The field "item_Description" exists in "table_Items" and has data in it; the "id_Item" is entered by the user on the form and is a combo box limiting the user to only the "id_Item" in the "table_Items". Spelling is correct.
I have used this function elsewhere with the same database and it works fine. Here is an example:
Code:
Private Sub textDistributorID_AfterUpdate()
textDistributorName = DLookup("distributor_Name", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorAddress1 = DLookup("distributor_Address1", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorAddress2 = DLookup("distributor_Address2", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorAddress3 = DLookup("distributor_Address3", "table_Distributor", "id_distributor=" & id_Distributor)
textDistributorCity = DLookup("distributor_City", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorState = DLookup("distributor_State", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorZipCode = DLookup("distributor_ZipCode", "table_Distributor", "id_Distributor=" & id_Distributor)
textDistributorCountry = DLookup("distributor_Country", "table_Distributor", "id_Distributor=" & id_Distributor)
End Sub
If there is any other information I can provide, please let me know!
Thank you.