Solved

building forms in Microsoft access with vba

Posted on 2014-03-05
6
4,762 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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.

803 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