how to switch subform between form and datasheetviews using code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top