1. Technology

VBA - Accessing Access


6 of 10

The Access Form - Our VBA Container
Creating a new Form

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 anotherselection of Design View versus several differenttypes 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.

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.

Now we do some code! Make sure the form is in design view and click the Toolbox in the main menu to display it and draw a command button on the form. Access assumes that the only reason you would put a command button on a form is to perform some standard action so Access automatically starts a wizard.

  1. About.com
  2. Technology
  3. Visual Basic

©2014 About.com. All rights reserved.