13.6. Connecting the User Interface to the Code

So far, your application will probably not compile because some features used in the code have not been written yet. You're almost finished with the application anyway. You are now ready to tie everything together by adding the VBA code to the Project Tracker and Contacts forms. Most of this code will be event procedures that fire, for example, when certain buttons are clicked. Some of the code will be local procedures in the form that deal with user-interface-specific features that would not make sense to put in a standard or class module.

13.6.1. The Projects Form

An example of the Project Tracker form, called frmProjects, is shown in Figure 13-26 with some sample data populated. You will revisit this form in more detail at the end of the chapter, where you will explore its cool features. For now, just keep this form in mind to help you understand the purpose of the code that you are about to write (and have already written).

Try It Out: Writing Code for the frmProjects Form

As previously mentioned, you are now ready to write the VBA code that will finish up the application. You will start with the frmProjects form and will finish with the frmContacts form.

  1. Open the frmProjects form and select the Form_Load event for the form to bring up the Visual Basic editor. Add the following code to the form:

    Private Sub Form_Load() On Error GoTo HandleError Set objProjects = New clsProjects Set rsProjects = New ADODB.Recordset 'load non-closed ...

Get Beginning Access™ 2007 VBA now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.