I am new to this and am trying to make a on exit expresion? that fills int the fields CITY and STATE from the zip codes table. The only problem is that it uses the 1st zip code from the table ONLY! Please help. What am I doing wrong?
Sub Zip_Exit(Cancel As Integer)
Dim varSTATE, varCITY As Variant
varSTATE = DLookup("STATE", "Zip Codes", "ZIP =[Zip]"
varCITY = DLookup("CITY", "Zip Codes", "ZIP =[Zip]"
If (Not IsNull(varSTATE)) Then Me![State] = varSTATE
If (Not IsNull(varCITY)) Then Me![City] = varCITY
End Sub
Sub Zip_Exit(Cancel As Integer)
Dim varSTATE, varCITY As Variant
varSTATE = DLookup("STATE", "Zip Codes", "ZIP =[Zip]"
varCITY = DLookup("CITY", "Zip Codes", "ZIP =[Zip]"
If (Not IsNull(varSTATE)) Then Me![State] = varSTATE
If (Not IsNull(varCITY)) Then Me![City] = varCITY
End Sub