I have seen many tips and replys to similar questions and have based the following vba code on them and Microsofts Building applications V2.o, but I Can't get it to work. I'm new to this game and long in the tooth so here it is.
Private Sub Combo234_AfterUpdate()
'Update Freight Company controls based on value selected in Freight_ID combo box
Dim varFreightCompany, varPhone, varWebSite As Variant
varFreightCompany = DLookup("[FreightCompany]", "tblFreightCompany", "[FreightCompany] = " & FreightCompany)
varPhone = DLookup("[Phone]", "tblFreightCompany", "[Phone] = " & PHONE)
varWebSite = DLookup("[WebSite]", "tblFreightCompany", "[WebSite] = " & WebSite)
If (Not IsNull(varFreightCompany)) Then Me![FreightCompany] = varFreightCompany
If (Not IsNull(varPhone)) Then Me![PHONE] = varPhone
If (Not IsNull(varWebSite)) Then Me![WebSite] = varWebSite
End Sub
I have an unbound combo box on my form (WorksCard) which is looking up an ID number on an unconnected table in the database called Freight Company. When I select the correct ID number I want the 3 fields in the code to auto fill. But I can't get it to work. I'm using the after update for the comboBox. I have recieved ERROR 3075 Syntax Error(missing operator) in Query expression'[FreightCompany] = '.
I'M lost and need found, Can anyone help.