Using Forms in Access Projects

3 4

You can base a project form on a database table, just as you can with a database form. For example, if you select the Authors table in the Publications project and click the New Object: AutoForm button on the Database Design toolbar, as shown in Figure 19-35, you'll see a simple form with the fields from the Authors table laid out on it, from top to bottom, as shown in Figure 19-36.

figure 19-35. you can create an autoform for a project table with a single click.

Figure 19-35. You can create an AutoForm for a project table with a single click.

figure 19-36. an autoform based on the authors table has an embedded subform.

Figure 19-36. An AutoForm based on the Authors table has an embedded subform.

The AutoForm has an embedded subform because the Authors table is linked one-to-many with the Titleauthor table.

You can create other types of forms based on tables using the Form Wizard, just as you can for database tables. Figure 19-37 shows a form based on the Stores table in the Publications project, with the Justified layout and the Ricepaper style.

figure 19-37. this form based on the stores table uses the justified layout and the ricepaper style.

Figure 19-37. This form based on the Stores table uses the Justified layout and the Ricepaper style.

Project Forms vs. Access Forms

Forms in Access projects can be based on tables, views, stored procedures, and Transact-SQL statements that return values. Also, in code only, forms can be bound to ActiveX Data Objects (ADO) recordsets. Although project forms based on tables work pretty much the same as forms based on database tables, when it comes to queries (views and stored procedures), there are some significant differences between database forms and project forms. When a project form is based on a query, it's updatable only if the user has the appropriate permissions (Add, Delete, or Update) for the underlying tables. If the user doesn't have the appropriate permissions, you must write VBA code to do the updating from an unbound form.

New Interface Elements

Forms in Access projects have two new buttons on their navigation bars: Cancel Query and Maximum Record Limit, as shown in Figure 19-38.

figure 19-38. an access project form has two additional buttons on the navigation bar.

Figure 19-38. An Access project form has two additional buttons on the navigation bar.

All project forms have the Cancel Query button, which is bright red when you initially open a form and the form fetches records from the underlying SQL Server table(s). It changes to gray when all the records have been fetched (or the number of records specified in the form's Max Records property has been fetched, whichever is lower). You can click the button while it's red to cancel the downloading of records if the downloading is taking too long.

To globally change the maximum number of records fetched from a SQL Server table, change the Default Max Records value on the Advanced tab in the Options dialog box, as shown in Figure 19-39.

figure 19-39. you can change the maximum records value in the options dialog box.

Figure 19-39. You can change the maximum records value in the Options dialog box.

You can also click the Maximum Record Limit button to open a small dialog box (shown in Figure 19-40) in which you can change the Max Records property quickly. This button is displayed by default; you can remove it by setting the Max Rec Button property to No on the Other tab in the form's properties sheet.

Figure 19-40. You can change the <i>Max Records</i> property in the Set Maximum Record Count dialog box.

Figure 19-40. You can change the Max Records property in the Set Maximum Record Count dialog box.

note


Curiously, the Max Rec Button property isn't located on the Format tab of the form's properties sheet along with the other buttons that can be turned on and off. Instead, it's on the Other tab.



Microsoft Access Version 2002 Inside Out
Microsoft Access Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612838
EAN: 2147483647
Year: 2005
Pages: 172
Authors: Helen Feddema

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net