'autopopulates city and state based on data entered into zip code field
Dim rs As Recordset
Dim tmpZip As String
If IsNull(txtPhyCity.Value) Then
If Len(txtPhyZip.Value) > 5 Then
tmpZip = Left(txtPhyZip.Value, 5)
Else
tmpZip = txtPhyZip.Value
End If
Set rs = ("Select * from CityZips Where ZipCode= '" & tmpZip & "'")
If Not rs.EOF Then
txtPhyCity.Value = rs("City")
txtPhySt.Value = rs("State")
End If
End If
Set rs = Nothing
|