Open form as Datasheet

  • Thread starter Thread starter pkeegs
  • Start date Start date
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?
 
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
 
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.
 
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
.
 
Back
Top