By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

Is there a way to permanently change access form properties using VBA?

P: 57
Tried the following code but it doesn't work. I was also hoping in adding this to the module so I can just call it in each forms using the me and not using form name.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Me.RecordSelectors = False
  3. Me.NavigationButtons = False
  4. Me.ScrollBars = 0
  5. [Forms]![frm_Import].DefaultView = 5
  6. [Forms]![frm_Import].PopUp = True
  7. [Forms]![frm_Import].SplitFormOrientation = 1
  8. End Sub
Feb 11 '15 #1

✓ answered by Seth Schrock

If you placed this is a regular module, then you can't use the Me keyword and you can't call a Private sub from another module or class. What you should do is create a parameter so that the calling form can send its name and then you can edit the calling form's properties. ry the following:
Expand|Select|Wrap|Line Numbers
  1. Public Sub EditProperties(Frm As String)
  2. Forms(Frm).RecordSelectors = False
  3. Forms(Frm).NavigationButtons = False
  4. 'Etc.
  5. End Sub
To call this, all you have to do is enter the following in the form's OnLoad event:
Expand|Select|Wrap|Line Numbers
  1. EditProperties Me.Name
Is there a reason you don't just set those properties in the properties window?

Share this Question
Share on Google+
4 Replies


Seth Schrock
Expert 2.5K+
P: 2,951
If you placed this is a regular module, then you can't use the Me keyword and you can't call a Private sub from another module or class. What you should do is create a parameter so that the calling form can send its name and then you can edit the calling form's properties. ry the following:
Expand|Select|Wrap|Line Numbers
  1. Public Sub EditProperties(Frm As String)
  2. Forms(Frm).RecordSelectors = False
  3. Forms(Frm).NavigationButtons = False
  4. 'Etc.
  5. End Sub
To call this, all you have to do is enter the following in the form's OnLoad event:
Expand|Select|Wrap|Line Numbers
  1. EditProperties Me.Name
Is there a reason you don't just set those properties in the properties window?
Feb 11 '15 #2

P: 57
Thanks it works! I'm just being lazy at changing it one by one. I a lot of databases to build and this saves me time.

The code below doesn't work though, could you assist?

Expand|Select|Wrap|Line Numbers
  1. Forms(frm).PopUp = True
I get a run-time error 2136:
to set this property, open the form or report in design view.
Feb 11 '15 #3

Seth Schrock
Expert 2.5K+
P: 2,951
Per the MSDN website, the Popup property can only be set in form design view.
Feb 11 '15 #4

Seth Schrock
Expert 2.5K+
P: 2,951
Another option is to create a form with the properties set how you want it and then same the form with the name of Normal. All new forms will be based on this template.
Feb 11 '15 #5

Post your reply

Sign in to post your reply or Sign up for a free account.