Switch between datasheet/form view by dbl-click

M

Matt

I'm trying to toggle between datasheet/form view on a
subform by double-clicking on a field in Access 2002.

This function under Access 2000 worked:

Public Function basToggleSubform()

Const MENU_VIEW = 2
Const CMD_SUBFORM_DATASHEET = 3

DoCmd.DoMenuItem acFormBar, MENU_VIEW,
CMD_SUBFORM_DATASHEET

End Function

It does not work under 2002. I've also tried switching
to the Docmd.RunCommand format:

Public Function basToggleSubform(frm As Form)

Const conformview = 1
Const condataview = 2
Dim intview As Integer

intview = frm.CurrentView

Select Case intview

Case conformview
DoCmd.RunCommand acCmdDatasheetView

Case condataview
DoCmd.RunCommand acCmdFormView

End Select

End Function

This gives me an error stating:

The expression you entered has a function containing the
wrong number of arguments.

I tried to add a shortcut menu to the form to be able to
switch between the two views, but the menu changes the
main form, not the subform. Even though the shortcut
menu is assigned the the subform itself.

I'm at a loss... any help would be aprreciated.
 

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

Top