P
Photios_Kim
I have a form where I put in customer's information. I also have a
table of zip codes and their corresponding towns and states. What I
want to do is make the for to where when the user enters the zip code,
the townand state automatically appear in their respective boxes.
Listed below is the code I used. The problem is that two towns are
assigned with one zip code. Even though I select second listed town,
but alwasy Town field is filled with town listed first. Anybody can
help me?
Thanks in advance.
Private Sub ServiceZip_AfterUpdate()
Dim varState, varTown As Variant
varState = DLookup("State", "ZipCodes", "Zip ='" & Me.[ServiceZip]
& "'")
varTown = DLookup("Town", "ZipCodes", "Zip = '" & Me.[ServiceZip] &
"'")
If (Not IsNull(varState)) Then Me![ServiceState] = varState
If (Not IsNull(varTown)) Then Me![ServiceTown] = varTown
End Sub
table of zip codes and their corresponding towns and states. What I
want to do is make the for to where when the user enters the zip code,
the townand state automatically appear in their respective boxes.
Listed below is the code I used. The problem is that two towns are
assigned with one zip code. Even though I select second listed town,
but alwasy Town field is filled with town listed first. Anybody can
help me?
Thanks in advance.
Private Sub ServiceZip_AfterUpdate()
Dim varState, varTown As Variant
varState = DLookup("State", "ZipCodes", "Zip ='" & Me.[ServiceZip]
& "'")
varTown = DLookup("Town", "ZipCodes", "Zip = '" & Me.[ServiceZip] &
"'")
If (Not IsNull(varState)) Then Me![ServiceState] = varState
If (Not IsNull(varTown)) Then Me![ServiceTown] = varTown
End Sub