I have a simple ZipCode - City/State dlookup function in my database:
This pretty much does what I want. You find the zip code in the combo box, select it and the City and State fields are automatically populated.
Where I am having trouble is how do you get around a user deleting the zip code if the record it was chosen for doesn't need it.
Right now I get:
"Run-time error '3075':
Syntax error (missing operator) in query expression '[ZIP] ='.
Debugging has the first line of code highlighted.
Code:
Private Sub cboZip_AfterUpdate()
strCity = DLookup("[City]", "[tblZIPS]", "[ZIP] = " & [ZIP])
strState = DLookup("[State]", "[tblZIPS]", "[ZIP] = " & [ZIP])
strZipCode = DLookup("[Zip]", "[tblZIPS]", "[ZIP] = " & [ZIP])
End Sub
Where I am having trouble is how do you get around a user deleting the zip code if the record it was chosen for doesn't need it.
Right now I get:
"Run-time error '3075':
Syntax error (missing operator) in query expression '[ZIP] ='.
Debugging has the first line of code highlighted.
Comment