Trouble closing a form

303factory

Registered User.
Local time
Today, 08:39
Joined
Oct 10, 2008
Messages
136
I'm having trouble closing a form. My close button has the following code behind it:

Code:
Me.SIMPresent = True
DoCmd.OpenForm "frmSIMExaminationSetup"
DoCmd.Close acForm, "frmExhibitContents"

Me.SIMPresent is a tix box hidden in a header. If I comment out that line the form closes fine. However if I dont I get 'this record has been changed by another user' errors (drop changes, save changes, copy to clipboard etc)

If I try to use Me.refresh or runcommand acCmdSaveRecord before the form close then the error just occurs one line earlier.

I didnt have this problem when I used an access back end its started happening now I'm using MySQL. It seems I'm unable to dirty a form by code and then close it without an error! I can dirty the form by clicking on it and typing without any problems..

Any help would be appreciated.

303
 
try to replace the two commands like this:
Code:
DoCmd.Close acForm, "frmExhibitContents"
DoCmd.OpenForm "frmSIMExaminationSetup"

see if it makes any difference.

Cheers
 
try to replace the two commands like this:
Code:
DoCmd.Close acForm, "frmExhibitContents"
DoCmd.OpenForm "frmSIMExaminationSetup"

see if it makes any difference.

Cheers

I'm afraid it doesnt make any difference :/
 
Investigating futher I tried building a much simpler version of my form.

I made a query with 1 text field, and a bound form with nothing but that field as a text box, and a close button.

Close button code:

Code:
Me.textBox = "blah"
DoCmd.Close acForm, "testForm"

I still get the problem! However it only occurs if the text field was already 'blah'. If I change it in the table to something else then run the code it doesnt give me the error. I think there must be something fundamentally wrong with my database...
 

Users who are viewing this thread

Back
Top Bottom