Guest_imported
New member
- Jan 1, 1970
- 0
Hello,
I try to fill fields automatically on form based on a control's value.
I have fields that there are "ST(state), CITY, ZIP" in table "MOTOR_CARRIERS". The form should be: When I enter Zip I will never have to enter State/City again.
The following are my codesbut not work)
Private Sub ZIP_Exit(Cancel As Integer)
Dim varST, varCity As Variant
varST = DLookup("[ST]", "MOTOR_CARRIERS", "[ZIP]=ZIP"
varCity = DLookup("[CITY]", "MOTOR_CARRIERS", "[ZIP]=ZIP"
If (Not IsNull(varST)) Then Me![ST] = varST
If (Not IsNull(varCity)) Then Me![CITY] = varCity
End Sub
Any suggestion?
Many Thanks.
Eric
I try to fill fields automatically on form based on a control's value.
I have fields that there are "ST(state), CITY, ZIP" in table "MOTOR_CARRIERS". The form should be: When I enter Zip I will never have to enter State/City again.
The following are my codesbut not work)
Private Sub ZIP_Exit(Cancel As Integer)
Dim varST, varCity As Variant
varST = DLookup("[ST]", "MOTOR_CARRIERS", "[ZIP]=ZIP"
varCity = DLookup("[CITY]", "MOTOR_CARRIERS", "[ZIP]=ZIP"
If (Not IsNull(varST)) Then Me![ST] = varST
If (Not IsNull(varCity)) Then Me![CITY] = varCity
End Sub
Any suggestion?
Many Thanks.
Eric