G
Guest
on a form i have a combo box (combo229) which once a value is selected it
updats fields on a form. the code in using in access2003 is below
Private Sub Combo229_AfterUpdate()
On Error GoTo Err_Combo229_AfterUpdate
' Add Customers Address Details To Work Order Form When Customer Name Is
Selected.
Me.Address1 = DLookup("[Address1]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Address2 = DLookup("[Address2]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.City = DLookup("[City]", "tblCustomersAddressBook", "[CustomerID] =
Combo229")
Me.County = DLookup("[County]", "tblCustomersAddressBook", "[CustomerID]
= Combo229")
Me.PostCode = DLookup("[PostCode]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.FirstName = DLookup("[FirstName]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.LastName = DLookup("[LastName]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Company = DLookup("[Company]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Title = DLookup("[Title]", "tblCustomersAddressBook", "[CustomerID]
=Combo229")
Exit_Combo229_AfterUpdate:
Exit Sub
Err_Combo229_AfterUpdate:
MsgBox Err.Description & ", " & Err.Number,
CurrentDb.Properties("AppTitle")
Resume Exit_Combo229_AfterUpdate
End Sub
when i select a value from the combo, i get a msgbox saying "cannot update
field". the error doesnt appear to come from this code as i get no err number
in the msgbox. im certain the error occurs as a result of the dlookup
functions in the code being NULL.
is there any way of supressing this msgbox as it serves no function.
updats fields on a form. the code in using in access2003 is below
Private Sub Combo229_AfterUpdate()
On Error GoTo Err_Combo229_AfterUpdate
' Add Customers Address Details To Work Order Form When Customer Name Is
Selected.
Me.Address1 = DLookup("[Address1]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Address2 = DLookup("[Address2]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.City = DLookup("[City]", "tblCustomersAddressBook", "[CustomerID] =
Combo229")
Me.County = DLookup("[County]", "tblCustomersAddressBook", "[CustomerID]
= Combo229")
Me.PostCode = DLookup("[PostCode]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.FirstName = DLookup("[FirstName]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.LastName = DLookup("[LastName]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Company = DLookup("[Company]", "tblCustomersAddressBook",
"[CustomerID] = Combo229")
Me.Title = DLookup("[Title]", "tblCustomersAddressBook", "[CustomerID]
=Combo229")
Exit_Combo229_AfterUpdate:
Exit Sub
Err_Combo229_AfterUpdate:
MsgBox Err.Description & ", " & Err.Number,
CurrentDb.Properties("AppTitle")
Resume Exit_Combo229_AfterUpdate
End Sub
when i select a value from the combo, i get a msgbox saying "cannot update
field". the error doesnt appear to come from this code as i get no err number
in the msgbox. im certain the error occurs as a result of the dlookup
functions in the code being NULL.
is there any way of supressing this msgbox as it serves no function.