ACC2003: OpenForm method with acFormReadOnly data mode

brother

Programmer
Local time
Today, 17:26
Joined
Mar 30, 2009
Messages
40
Hi,

I have three buttons that open the same form in different data modes.
The different modes are:
acFormPropertySettings
acFormEdit
acFormReadOnly

The event code looks like this:
Code:
DoCmd.OpenForm "Form2", , , "[ID]=forms!Form1.form![ID]", [B]acFormReadOnly[/B]

Now, over to my problem. Everything works fine when I open the form in PropertySettings and Edit mode. After I open the form in ReadOnly mode, the readonly data mode becomes the forms permanent PropertySettings. After opening in readonly mode, I'm not able to go into Edit mode to edit the records.

I created a small test database to try to replicate this problem, but everything works fine in all three modes.

Whats up with that?!

Any help on this matter is GREATLY appreciated!!
 
Having used;
Code:
DoCmd.OpenForm "Form2", , , "[ID]=forms!Form1.form![ID]", [B]acFormReadOnly[/B]

Read Only is how the form will stay until you you tell it otherwise. On other buttons that open the form use;
Code:
DoCmd.OpenForm "Form2", , , "[ID]=forms!Form1.form![ID]", [B]acFormPropertySettings[/B]
 
Alternatively use;
Code:
Me.RecordLocks = False
In the forms On Close event, this will have the same effect.
 
I just copied the OP's scenario and using

DoCmd.OpenForm "Form2", , , "[ID]=forms!Form1.form![ID]", acFormReadOnly

does not permanently change it to Read-Only, and shouldn't. There's nothing in that code to change it's Default View. Running Read-Only then running Edit works as suspected.
 
I just copied the OP's scenario and using

DoCmd.OpenForm "Form2", , , "[ID]=forms!Form1.form![ID]", acFormReadOnly

does not permanently change it to Read-Only, and shouldn't. There's nothing in that code to change it's Default View. Running Read-Only then running Edit works as suspected.

Ahh yes. I've just discovered what happens when you Assume too much :o I had assumed that it was one of those properties that persisted :(
 
Hello there,

It seems that when opening in acFormReadOnly, the forms design is saved and becomes the default view. This is strange, because there is absolutely no code or event telling it to save. Furthermore, when testing the exact same database in ACC2007 (both with and without converting it), it works just fine.

Because I'm stuck with ACC2003 for now, I have put this line of code in the Form_Close event of Form2:

Code:
DoCmd.Close , "Form2", acSaveNo

This took care of this strange problem.

Thanks for all the help!
 

Users who are viewing this thread

Back
Top Bottom