Solved

building forms in Microsoft access with vba

Posted on 2014-03-05
6
4,692 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

863 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

27 Experts available now in Live!

Get 1:1 Help Now