cannot update field error box

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.
 
O

OfficeDev18 via AccessMonster.com

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
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.
 
G

Guest

sorry but this hasnt cured the error msgbox. maybe is not the null values.



OfficeDev18 via AccessMonster.com said:
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
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.
 
O

OfficeDev18 via AccessMonster.com

Would you ZIP and upload your database here? At least the form and some
records from pertinent tables, as well as queries, etc. that the form uses?

Sam
sorry but this hasnt cured the error msgbox. maybe is not the null values.
You might try using the Nz() function, as in:
[quoted text clipped - 49 lines]
 
S

Stefan Hoffmann

hi,
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
Drop the error handler to examine the error when it happens and where it
happens.


mfG
--> stefan <--
 
G

Guest

after some investigations it indicates that the error occurrs when crating a
new record. the action from the combo box generates a new record in a qry.

this was all workin gok, what puzzles me more is that i have 3 different
revisions of this database and all databases are effected but wasnt
yesterday. any ideas whats gone on?
 
G

Guest

some more info,

when you press ok on the msgbox, the msgbox reappears 5 times then it stops.
once you have selected ok on all 5 msgboxes the form inserts the record ok
and you can work with it. the error numbers is 3164. no users setup in
database

StuJol said:
after some investigations it indicates that the error occurrs when crating a
new record. the action from the combo box generates a new record in a qry.

this was all workin gok, what puzzles me more is that i have 3 different
revisions of this database and all databases are effected but wasnt
yesterday. any ideas whats gone on?

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top