I have a form that you enter various zip codes and it gives you the distance between the to zip codes. I need to be able to enter numerous zip codes into the form and return the nearest city. The code I am using is:
Private Sub ZipCode1_Exit(Cancel As Integer)
If ZipCode1 <> "" Then
stLinkCriteria = "[zipcode] = '" & Trim(Me.ZipCode1) & "'"
Me.City1 = DLookup("[City]", "dbo_zips", stLinkCriteria)
Me.State1 = DLookup("[State]", "dbo_zips", stLinkCriteria)
Me.Long1 = DLookup("[long]", "dbo_zips", stLinkCriteria)
Me.Lat1 = DLookup("[lat]", "dbo_zips", stLinkCriteria)
End If
End Sub
Thanks in advance for your help.
Private Sub ZipCode1_Exit(Cancel As Integer)
If ZipCode1 <> "" Then
stLinkCriteria = "[zipcode] = '" & Trim(Me.ZipCode1) & "'"
Me.City1 = DLookup("[City]", "dbo_zips", stLinkCriteria)
Me.State1 = DLookup("[State]", "dbo_zips", stLinkCriteria)
Me.Long1 = DLookup("[long]", "dbo_zips", stLinkCriteria)
Me.Lat1 = DLookup("[lat]", "dbo_zips", stLinkCriteria)
End If
End Sub
Thanks in advance for your help.