Access from "Form View" to "Datasheet View"

J

johan

Hoi,

Somebody can help me out.

I need a macro where I can switch from the database "Form View" to the
"Datasheet View".
I can do it with the menubar option, but I want to do it with a
button.

regards,
Johan
 
G

Goblin

Hi johan,

I'm using Access 2000, but guess there will be not much differences in the
new versions:

In the click_event of a button in a mask, try something like this:

If (Me.CurrentView = 1) Then ' Mask
DoCmd.RunCommand acCmdDatasheetView
ElseIf (Me.CurrentView = 2) Then ' Datasheet
DoCmd.RunCommand acCmdFormView
End If

In effect, the second condition is not fired, because in datasheet view the
button is no more present, but you can link this code to a different source

Hope this helps.
Bye.
 

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