Re: cannot update field error box

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You might try using the Nz() function, as in:

Me.Address1 = Nz(DLookup("[Address1]", "tblCustomersAddressBook", >"
[CustomerID] = Combo229")," ")

If the problem is null values, that should get rid of the problem.

Sam

StuJol wrote:
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.

--
Sam

Message posted via http://www.accessmonster.com
.



Relevant Pages

  • Re: Random messages pop up
    ... Private Sub Workbook_Open ... If i = 2 Then MsgBox "Read your call quality guide!" ... The macro needs to go into the workbook's code module. ... "Remember to apritaite your customers" ...
    (microsoft.public.excel.worksheet.functions)
  • Re: cannot update field error box
    ... sorry but this hasnt cured the error msgbox. ... Private Sub Combo229_AfterUpdate ... ' Add Customers Address Details To Work Order Form When Customer Name Is ...
    (microsoft.public.access.formscoding)
  • Re: cannot update field error box
    ... updats fields on a form. ... Private Sub Combo229_AfterUpdate ... On Error GoTo Err_Combo229_AfterUpdate ... Drop the error handler to examine the error when it happens and where it happens. ...
    (microsoft.public.access.formscoding)