how to switch subform between form and datasheetviews using code

S

skulmat

i am trying to figure out what code i can put on a command button that will
allow me to switch a SUBforms view between regulr and datasheat views.

thankyou
 
D

Dirk Goldgar

skulmat said:
i am trying to figure out what code i can put on a command button
that will allow me to switch a SUBforms view between regulr and
datasheat views.

If the command button isn't on the subform, you must first set the focus
to the subform, using a line like this:

Me!YourSubformName.SetFocus

When the subform has the focus, you can toggle the subform between form
view and datasheet by executing this line:

RunCommand acCmdSubformDatasheet

In Access 2002 (and, presumably, 2003), you can specify form view or
datasheet view, regardless of the subform's current view, by using

RunCommand acCmdSubformDatasheetView

or

RunCommand acCmdSubformFormView

These constants didn't exist in earlier versions.
 
Top