473,411 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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

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?

4 1622
Seth Schrock
2,965 Expert 2GB
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
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
2,965 Expert 2GB
Per the MSDN website, the Popup property can only be set in form design view.
Feb 11 '15 #4
Seth Schrock
2,965 Expert 2GB
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

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

Similar topics

2
by: dtemlak | last post by:
Hi there I am a bit new to vb.net. I have figured out how to use a data reader to get column and row information from my MS Access database using OLEDB. The problem is that while I can easily get...
13
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which...
1
by: Tim Graichen | last post by:
Hello, I currently have a subform that displays four fields from a query. I have the subform's properties set as follows, so that the end users can not accidently change the data. Allow...
1
by: Sylvia S. | last post by:
Hello, I want to make a form based on a table with many records. I used the wizard to make a 'form in table layout'. The wizard is not able to make the form due to too many fields. I discovered...
1
by: Arend Jan Nijenhuis | last post by:
Hi, I'm fairly new to .Net, but an expert in Microsoft Access VBA. For a large Access application, I want to create some sort of custom control (COM interop?) in VB.Net, to be used in an Access...
15
by: kokostik | last post by:
I did a few searches, but couldn't come up with a clear answer to my question. So here it is: If I am in an open form (MyForm1), is it possible to set the RecordSource of an un-opened form...
9
by: Dimsion | last post by:
Hi, How do i expose all my forms and it controls to other form in the project? I want to be able to add a form and some control on it, this then be available to all other forms. form1 click...
1
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works...
10
jamjar
by: jamjar | last post by:
How do I change the form view using VB after the form is opened? I am using the Switchboard pretty much as the wizard loads it. I've tweaked the appearance and a couple of lines of code but I...
2
by: ncsthbell | last post by:
I am running MS Access 2007. If I have an access application running on a network can I control the read/write access for the data by setting the form properties to yes or no for "Allow Additions",...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.