B
Bill
I'm trying to do a zip code look up where the user enters a zip code then the
city and state is populated base on a table. My table is called ZIP_CODES and
the table which will be holding all data is "Address". When the user enters
the zip code into the form I want the city and state to autofill. Here's
what I have:
Private Sub Zip_Code_AfterUpdate()
Dim rsCurr As DAO.Recordset
Dim strSql As String
strSql = "SELECT City, State " & _
"FROM tblZIP_CODES " & _
"WHERE Left(Zip_Code, 5) = '" & Left(txtZip_Code.Value, 5) & "'"
Set rsCurr = CurrentDb().OpenRecordset(strSql)
If rsCurr.EOF = False Then
State = rsCurr!State
txtCity = rsCurr!City
End If
End Sub
Thanks for the help.
Bill
city and state is populated base on a table. My table is called ZIP_CODES and
the table which will be holding all data is "Address". When the user enters
the zip code into the form I want the city and state to autofill. Here's
what I have:
Private Sub Zip_Code_AfterUpdate()
Dim rsCurr As DAO.Recordset
Dim strSql As String
strSql = "SELECT City, State " & _
"FROM tblZIP_CODES " & _
"WHERE Left(Zip_Code, 5) = '" & Left(txtZip_Code.Value, 5) & "'"
Set rsCurr = CurrentDb().OpenRecordset(strSql)
If rsCurr.EOF = False Then
State = rsCurr!State
txtCity = rsCurr!City
End If
End Sub
Thanks for the help.
Bill