docmd.Openform as datasheet

C

Chris C.

I've got a form which is designed to default/allow only datasheet view.
When I open it via the db container, it opens as a datasheet. When I open
it via a docmd.openform in a button on another form of mine, it opens in
form view. What command do I need to use in my button to get it to open as
a datasheet?
 
B

Bruce M. Thompson

I've got a form which is designed to default/allow only datasheet view.
When I open it via the db container, it opens as a datasheet. When I open
it via a docmd.openform in a button on another form of mine, it opens in
form view. What command do I need to use in my button to get it to open as
a datasheet?

When opening the form in code, you need to include the "View" argument
"acFormDS" that tells the form to open in datasheet view:

DoCmd.OpenForm "MyForm", acFormDS
 

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