bobbobruns12
Technical User
IF Anyone can help this would be great as this seems like I've done it right. I have created a database which has stored numeric tables and have used Dlookup in the control properties to be able to automatically fill in Text boxes on forms. One of these text boxes, CityCode, fill's in the zip code of a city and state when the city and state are entered onto the form. However if this process completes and the city and state are not recognized, then it just leaves the textbox blank. I am trying to create a macro which displays an error message if the this field is left blank.
Here is the code i created for DLookUp:
=DLookUp("[ZipCode]","ZipCode","[City] = '" & [City] & "' AND [StateCode] = '" & [State] & "'")
In the Macro I have
Conditions: [CityCode] Is Null
Action: MsgBox
etc etc etc
I put this under the textbox CityCode Event Property on AfterUpdate yet the macro does not run when this textbox is left empty so I'm wondering if I may have missed something or maybe there's a better way to do it. Thanks to anyone who could help
Here is the code i created for DLookUp:
=DLookUp("[ZipCode]","ZipCode","[City] = '" & [City] & "' AND [StateCode] = '" & [State] & "'")
In the Macro I have
Conditions: [CityCode] Is Null
Action: MsgBox
etc etc etc
I put this under the textbox CityCode Event Property on AfterUpdate yet the macro does not run when this textbox is left empty so I'm wondering if I may have missed something or maybe there's a better way to do it. Thanks to anyone who could help