Making a form Read Only via VBA

branston

Registered User.
Local time
Today, 20:42
Joined
Apr 29, 2009
Messages
372
Hi,

I have a button which opens a form. The form is currently edit-able, and has to be a lot of the time, but when its opened through this particular route I need it to be read only.
I have tried:
stDocName = "FrmName"
DoCmd.OpenForm stDocName
Form.FrmName.AllowAdditions False
Form.FrmName.AllowDeletions False
Form.FrmName.AllowEdits False

but it comes up with an error. I think im not calling the form correctly, but im not too sure.

Any help would be greatly appreciated.

Thank you!
 
Proper syntax is:
Forms("FormName").AllowAdditions = False

Alternative is to use the Openargs part to tell the form itself what to do... so that in your on open event you can read that Openargs (part of the DoCmd.Openform command) and use Me.AllowblaBla = xyz to set it up correctly
 
Brilliant, I thought i was probably missing something like that!
Thank you!
 

Users who are viewing this thread

Back
Top Bottom