Open form as Datasheet

P

pkeegs

I have created a form to open in Datasheet view. When I open it from the
database window it opens correctly. When I open it from another form with a
button, it will only open in Form view. Property Default view is set to
Datasheet, and Allow Datasheet View is set to Yes, the others to No. What
have I missed?
 
K

Keven Denen

I have created a form to open in Datasheet view. When I open it from the
database window it opens correctly. When I open it from another form witha
button, it will only open in Form view. Property Default view is set to
Datasheet, and Allow Datasheet View is set to Yes, the others to No. What
have I missed?

Assuming you are using the VBA DoCmd.OpenForm, the second argument it
expects is what view to use. The default here is Normal (Form view).
You want to have it be acFormDS.

DoCmd.OpenForm "formname", acFormDS

Keven Denen
 
D

Dirk Goldgar

pkeegs said:
I have created a form to open in Datasheet view. When I open it from the
database window it opens correctly. When I open it from another form with
a
button, it will only open in Form view. Property Default view is set to
Datasheet, and Allow Datasheet View is set to Yes, the others to No. What
have I missed?


When you open the form by DoCmd.OpenForm, you have to specify acFormDS for
the View argument if you want it to be opened in datasheet view:

DoCmd.OpenForm "Form1", acFormDS

This is true even if the form's default view is set to Datasheet.
 
P

pkeegs

Thanks guys.

Keven Denen said:
Assuming you are using the VBA DoCmd.OpenForm, the second argument it
expects is what view to use. The default here is Normal (Form view).
You want to have it be acFormDS.

DoCmd.OpenForm "formname", acFormDS

Keven Denen
.
 

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