More DoCmd methods for forms
The DoCmd object used in the preceding example to open and close forms provides many methods for working with data on forms. Table 6-3 summarizes some of the more commonly used DoCmd methods for working with forms and data in forms.
|
Table 6-3 Commonly Used DoCmd Methods | ||
|
To Do This |
Use This | |
|
Move cursor to a specific control |
DoCmd. |
.GoToControl |
|
Select object |
DoCmd. |
.SelectObject |
|
Move to a specific record |
DoCmd. |
. GoToRecord |
|
Find a record |
DoCmd. |
.FindRecord |
|
Find next matching record |
DoCmd. |
.FindNext |
|
Filter records in a form |
DoCmd.ApplyFilter | |
|
Remove filter |
DoCmd. |
.ShowAllRecords |
|
Sound a beep |
DoCmd. |
. Beep |
|
Print form (or other object) |
DoCmd. |
. PrintOut |
|
Save form (or other object) |
DoCmd. |
.Save |
|
Perform a command from the menu bar |
DoCmd. |
. RunCommand |
|
Copy a form (or other object) |
DoCmd. |
.CopyObject |
|
Rename form (or other object) |
DoCmd. |
.Rename |
|
Delete a form (or other object) |
DoCmd. |
. DeleteObject |
|
Send object electronically |
DoCmd. |
. SendObject |
You don't need to study and memorize them all now because you can easily get detailed information on an as-needed basis. Just type the beginning of the statement into your code, as follows:
DoCmd.GoToRecord
Just double-click the method name (such as GoToRecord) to select it and then press F1.
The Object Browser, which is always available in the VBA editor, provides another great resource for getting quick information on methods of the DoCmd object (as well as every other object in your database). To open the Object Browser in the VBA editor, choose ViewOObject Browser from the VBA editor's menu bar or press F2 while you're in the VBA editor.
See Chapter 2 for more information on using the Object Browser.
After the Object Browser is open, click DoCmd in the left column. The methods that DoCmd supports will be listed down the right pane. For help with a particular method, click its name in the right column and then click the Help button near the top of the Object Browser (see Figure 6-10).
Help
Figure 6-10:
Methods of the DoCmd object in the Object Browser.
Help
Figure 6-10:
Methods of the DoCmd object in the Object Browser.
- DoCmd selected DoCmd methods
Average user rating: 1 stars out of 2 votes
Post a comment