1. Home
  2. Computing & Technology
  3. Visual Basic
VBA - Accessing Access
Part 4: The Access Form - Our VBA Container
 More of this Feature
• Part 1: VBA - Accessing Access
• Part 2: VBA in Access
• Part 3: Coding the Access Example
• Part 5: VBA Code Calling the Excel Server
• Part 6: The VBA Code
 
 Join the Discussion
Have you created a system using VBA Automation ?
Tell us about it!
 
 Related Resources
• Beginning Visual Basic
• Visual Basic 6
 
 From Other Guides
• About Databases
• About Business Software
 
 Elsewhere on the Web
• Professional Access 2000 Programming
From Wrox

• Updates from Microsoft
(Browse to Office 2000)

 

As noted earlier, Access VBA code can be in a variety of different modules. We're going to put all of ours in an Access Form. So Select Form to create it. This time, we use the Wizard so we can connect it to our database more easily. It doesn't matter what style or background you select. Click Modify the Form's Design before clicking Finish on the last dialog.

Creating a new Form

If you're completely new to Access 2000, the screens can be a little confusing at this point. Remember that the New > Form dialog doesn't show the table you have created until you name and save it. (I called it AboutVBA.) Also, After you click New > Form with Create Form by using wizard selected, the next dialog's listbox has another selection of Design View versus several different types of wizards. Select Design View in this listbox and click the dropdown listbox to select the AboutVBA table.

When the form is displayed, click and drag the memo field to the form. You might have to click the Field List button on the toolbar before the Fields are displayed. This action binds the database field to the textbox on the form. Access is such an easy-to-use database that it's actually usable at this point. If you Open the form and type text into the field, the text will be stored in the table.

The initial form

I modified the text box and deleted the label to customize the form slightly (see the Final Result at the end of the article) but the code works the same way whether you do this or not.

Next page > The VBA Code > Page 1, 2, 3, 4 5, 6
Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.