I'm having a hard time following your exact scenario here; sorry!
Are you physically (i.e. thru the keyboard or copying and pasting it in) entering the origin and destination zip codes in the same Form where you want the the origin and destination locations to be filled in?
If so, and the ZipField is defined as a Text Datatype:
Code:
Private Sub txtDestinationZIP_AfterUpdate()
Me.DestinationLocation = DLookup("LocationField", "YourZipLocationTable", "[ZipField] = '" & Me.txtOriginZip & "'")
End Sub
Private Sub txtOriginZIP_AfterUpdate()
Me.OriginLocation = DLookup("LocationField", "YourZipLocationTable", "[ZipField] = '" & Me.txtOriginZip & "'")
End Sub
If ZipField is defined as a Number Datatype
Code:
Private Sub txtDestinationZIP_AfterUpdate()
Me.DestinationLocation = DLookup("LocationField", "YourZipLocationTable", "[ZipField] = " & Me.txtOriginZip)
End Sub
Private Sub txtOriginZIP_AfterUpdate()
Me.OriginLocation = DLookup("LocationField", "YourZipLocationTable", "[ZipField] = " & Me.txtOriginZip)
End Sub
You'll have to replace Field, Control and Table names in the code with your actual names, of course.
BTW, you'll seldom get Macros from anyone here! We're a VBA sort of crowd!
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007