• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 29. Handling Events with VBA 6.0 > Working with Access 2002's DoCmd Met...

Working with Access 2002's DoCmd Methods

Some of the DoCmd methods duplicate menu commands, such as Print, Close, and Apply Filter/Sort. Other methods substitute for mouse actions. For example, you can use the SelectObject method to select a database object in the same way that you select an open window by clicking it or select a database object in the Database window by clicking the object's name. Other DoCmd methods provide capabilities that aren't available through menu commands, such as Beep, which emits a beep sound, or MsgBox, which displays a custom message. It's a better practice, however, to execute Beep and MsgBox directly with VBA statements.

DoCmd Methods by Task

Table 29.2 lists available DoCmd methods grouped by task. Access 2.0 provided 47 macro actions; Access 95 added 2 new DoCmd methods: Save and SetMenuItem. Access 2000 replaced the DoMenuItem action or method with the RunCommand method, which lets you execute any native menu choice or standard toolbar button. The AddMenu item in the Method column of Table 29.2 is an Access 95 and earlier macro action; it's not a method of the DoCmd object and can't be executed from Access VBA code. An asterisk (*) indicates DoCmd methods added in Access 2002.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint