Weird: Code works in MDB but not in MDE

M

mscertified

I have an MDB that works flawlessly but when I create an MDE from it gives
the following error:

"The expression After Update you entered as the event property setting
produced the following error: You can't assign a value to this object.

This is 'after update' event of combo box. Any clues??? I was getting this
in the MDB but commented the offending statements out the recompiled. How do
I debug an MDE?
 
J

Jeff Boyce

Was the MDB compiled before creating the MDE? Was the MDE created using the
same version of Access that the MDB was created in?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

mscertified

yes to both questions.

Jeff Boyce said:
Was the MDB compiled before creating the MDE? Was the MDE created using the
same version of Access that the MDB was created in?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

Klatuu

How about posting the code in the After Update event and point out the line
where the error occurs?
 
M

mscertified

OK, I have determined the following:-
With no OnError trap in the code the MDB does not generate an error but the
MDE does.
If I put OnError trap in MDB, an error is generated

Code (there are combo boxes in a continuous form subform):

Private Sub Defect_AfterUpdate()
On Error GoTo ER
Me!CorrectiveActions.Value = Null
Me!DefectID = Me!Defect.Column(0) <==== Fails
Exit Sub
ER:
MsgBox Err.Description, , "Defect_AfterUpdate"
End Sub

Private Sub CorrectiveActions_AfterUpdate()
On Error GoTo ER
Me!CAID = Me!CorrectiveActions.Column(0) <==== Fails
Exit Sub
ER:
MsgBox Err.Description, , "CorrectiveActions_AfterUpdate"
End Sub
 
D

Douglas J. Steele

Not sure whether this is related to your problem, but that's not really
proper error handling.

Once an error's raised, you need to clear it. Typically, this is done using:

Private Sub Defect_AfterUpdate()
On Error GoTo ER
Me!CorrectiveActions.Value = Null
Me!DefectID = Me!Defect.Column(0)
Done:
Exit Sub
ER:
MsgBox Err.Description, , "Defect_AfterUpdate"
Resume Done
End Sub

although I supposed you could use

Private Sub Defect_AfterUpdate()
On Error GoTo ER
Me!CorrectiveActions.Value = Null
Me!DefectID = Me!Defect.Column(0) <==== Fails
Exit Sub
ER:
MsgBox Err.Description, , "Defect_AfterUpdate"
Err.Clear
End Sub
 
M

mscertified

Thanks for the tip. I've been doing it that way for years and its never to my
knowledge caused a problem.
 

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