Opening a form in Datasheet View

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to view a form in Datasheet View. I open it from another form
and when it opens it is in the normal view. In the design I have put the
default view as Datasheet. What must I do? Must I include something else in
my VBA code. This is my code: DoCmd.OpenForm "Testfrm", , , "[EmployeeID]="
& Me![cboEmployeeID]. Thanks for the help.
 
Hi Dan,
Must I include something else in my VBA code.

Yes. The default view, which you did not specify (ie. the second parameter)
is acNormal. If you select "DoCmd.OpenForm" with your mouse, and press the F1
key, you should open context sensitive help. Here, you will see that View is
an optional parameter, with the default being acNormal.

You can use either this:

DoCmd.OpenForm "Testfrm", acFormDS, , "[EmployeeID]=" & Me![cboEmployeeID]

or this form, which uses named arguments:

DoCmd.OpenForm FormName:="Testfrm", View:=acFormDS, _
WhereCondition:="[EmployeeID]=" & Me![cboEmployeeID]

The named argument method allows one to eliminate the extra positional
commas. You can place the named arguments in any order you want.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

danh said:
I am trying to view a form in Datasheet View. I open it from another form
and when it opens it is in the normal view. In the design I have put the
default view as Datasheet. What must I do? Must I include something else in
my VBA code. This is my code: DoCmd.OpenForm "Testfrm", , , "[EmployeeID]="
& Me![cboEmployeeID]. Thanks for the help.
 

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

Back
Top