Solved

building forms in Microsoft access with vba

Posted on 2014-03-05
6
4,573 Views
Last Modified: 2014-03-06
hi


Does anyone have code that allows building forms in Microsoft access, like the form wizard, something that i can control and add to there my personal preference that I do routinely on every form. this can save me a lot of time of work
0
Comment
Question by:bill201
6 Comments
 
LVL 22

Assisted Solution

by:Kelvin Sparks
Kelvin Sparks earned 166 total points
ID: 39908475
Here's a link to get you started
http://forums.databasejournal.com/showthread.php?33839-Programmatically-create-a-form-using-VBA

I suspect if you can get the Access Developers books by Ken Getz et al, there'll be full code examples there.

Kelvin
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 39908478
0
 
LVL 10

Assisted Solution

by:Anthony Berenguel
Anthony Berenguel earned 167 total points
ID: 39908479
Hi Bill,

Take a look the first reply in the link below that explains how to add a textbox control to a form. I think once you figure that out it will be easy for you to add the other controls and you can go from there.

example

Good luck,
ab
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:bill201
ID: 39908642
aebea


thanks for your answer but the link don't work
0
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 167 total points
ID: 39908648
Hi,

you can of course build a form programmatically but there are easier methods to achieve what you want (>= A2007):

1. Form Templates


Create a form which you want to use as template and set all the desired properties. Then open the Access options and go to "Object Designers". Scroll down to the section "Forms/Reports", there you'll find two input boxes where you can enter the name of the form which should be used for any new form (and the other one the same for reports)

2. Control Templates


This one can be used in all forms but is valid only for the current form, not all forms. Open the form in design mode and click on the control you normally would insert now into your form. Instead of inserting it, go to the properties window and you'll see that the title has changed to "Default Text Box" (if you clicked the TextBox icon before). Now you can setup all the desired properties for the TextBox and whenever you insert one into this form it will have the default settings.

3. Assign template layout


(This one also works in versions before A2007). When you have created your template form, open it in Layout View and then open the rightmost dropdown "AutoFormat" in the "Format" ribbon. Select "Autoformat Wizard" at the bottom to open the good old AutoFormat selector known from earlier versions (there in the Form Assistant). Click on the "Customize" button and there you can choose "Create a new AutoFormat based on the form "YourTemplateForm"". This will be added to the AutoFormat list and in your next form you can simply choose that to apply all your formattings.

4. Template Forms Copy


The even simplest method: Create a template form with controls and code and anything you want including the above described Control Templates and save it as a template form. Whenever you need that, copy and paste it to a new form, that's it. With this you can have as many forms as you want. You could even create a template database to store such forms and drag and drop that from one database to another.

5. Use tools


You can also use tools to manage your templates, one of this (freeware) can be found here:
http://www.skrol29.com/us/vtools.php

More information about templates can also be found at Allen Browne's page here:
http://allenbrowne.com/ser-43.html

Cheers,

Christian
0
 

Author Closing Comment

by:bill201
ID: 39908726
thanks a lot
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now