K
Karl H
Hi,
I'm linking City & State to a zip code, but I want the function to pay
attention to just the first 5 numbers in the zip code. Please advise how I
would change this code to make that happen.
'Links some zip codes to cities
Private Sub txtZipCode_AfterUpdate()
Dim rsCurr As DAO.Recordset
Dim strSql As String
strSql = "SELECT City, State FROM tblCity WHERE Zip = '" & txtZipCode & "'"
Set rsCurr = CurrentDb().OpenRecordset(strSql)
If rsCurr.EOF = False Then
State = rsCurr!State
txtCity = rsCurr!City
End If
End Sub
Thank you,
Karl
I'm linking City & State to a zip code, but I want the function to pay
attention to just the first 5 numbers in the zip code. Please advise how I
would change this code to make that happen.
'Links some zip codes to cities
Private Sub txtZipCode_AfterUpdate()
Dim rsCurr As DAO.Recordset
Dim strSql As String
strSql = "SELECT City, State FROM tblCity WHERE Zip = '" & txtZipCode & "'"
Set rsCurr = CurrentDb().OpenRecordset(strSql)
If rsCurr.EOF = False Then
State = rsCurr!State
txtCity = rsCurr!City
End If
End Sub
Thank you,
Karl