Using DLookup...but Need to edit if not found?

WineSnob

Not Bright but TENACIOUS
Local time
Today, 07:53
Joined
Aug 9, 2010
Messages
211
I am using:
=DLookUp("city","tblParrishZipCityAreaCode","zip = forms!xfrmWONew!LocationZip")
in a control on a form to get the "city" from the zip control on the form. Works Fine. HOWEVER, I need to be able to edit or enter a city if the Dlookup doesn't return a value because the zip is not in the table.
What is the best way to utilize a lookup feature for the user and still allow edits?
 
I would probably use a combo box to allow users to select a zip, and use the Not In List event to let them add new values. If you go that way, searching here for "notinlist" should find code samples. You could then use this to display the related city instead of the less efficient DLookup:

http://www.baldyweb.com/Autofill.htm
 

Users who are viewing this thread

Back
Top Bottom