newbee2
Technical User
- Apr 21, 2002
- 85
I have seen many quetions put forward similar to mine, and from those and from The Microsoft Access Building Applications book V2.0 came up with the following which I can't get to work.
Private Sub Combo234_AfterUpdate()
'Update Freight Company controls based on value selected in Freight_ID combo box
Dim varFreightCompany, varPhone, varWebSite As Variant
varFreightCompany = DLookup("[FreightCompany]", "tblFreightCompany", "[FreightCompany] = " & FreightCompany)
varPhone = DLookup("[Phone]", "tblFreightCompany", "[Phone] = " & Phone)
varWebSite = DLookup("[WebSite]", "tblFreightCompany", "[WebSite] = " & WebSite)
If (Not IsNull(varFreightCompany)) Then Me![FreightCompany] = varFreightCompany
If (Not IsNull(varPhone)) Then Me![Phone] = varPhone
If (Not IsNull(varWebSite)) Then Me![WebSite] = varWebSite
End Sub
I ahve an unbound Combobox on my form which calls up an Id number from another table. When the Id number is selected I was hoping to auto fill 3 feilds on my form. Which it doesn't do. What am I doing wrong?
Thanks
Neewbee2
Private Sub Combo234_AfterUpdate()
'Update Freight Company controls based on value selected in Freight_ID combo box
Dim varFreightCompany, varPhone, varWebSite As Variant
varFreightCompany = DLookup("[FreightCompany]", "tblFreightCompany", "[FreightCompany] = " & FreightCompany)
varPhone = DLookup("[Phone]", "tblFreightCompany", "[Phone] = " & Phone)
varWebSite = DLookup("[WebSite]", "tblFreightCompany", "[WebSite] = " & WebSite)
If (Not IsNull(varFreightCompany)) Then Me![FreightCompany] = varFreightCompany
If (Not IsNull(varPhone)) Then Me![Phone] = varPhone
If (Not IsNull(varWebSite)) Then Me![WebSite] = varWebSite
End Sub
I ahve an unbound Combobox on my form which calls up an Id number from another table. When the Id number is selected I was hoping to auto fill 3 feilds on my form. Which it doesn't do. What am I doing wrong?
Thanks
Neewbee2