Datasheet View property does not work consistently

G

Guest

Greetings...

I've set my form properties to permit datasheet view only however when I
initially open the form . . . it goes directly to the "Form View"...not
datasheet...

Is there something that I may add to the "On Open" event property to remedy
this?

V/R,
Steve
 
A

Allen Browne

If you open the form from the Database window, it will open in whatever you
defined in its Default View property.

If you use OpenForm to open it programmatically, specify the view, e.g.:
DoCmd.OpenForm "Form1", acFormDS
 
G

Guest

When I entered the following command into the "On Open Event Property":

DoCmd.OpenForm "Frm_MethodCount", acFormDS

I get the following error message:

Run time error '2174'
You can't switch to a different view at this time

Was I correct to replace "Form1" w/ the actual name of my form? If so, I'm
not sure why I'm getting the error message...

p.s., when I open the same form w/ a macro...it opens properly in datasheet
view...

Steve
 
A

Allen Browne

The code does not go into the On Open property of the form.

Presumably the form is closed at the time you want to open it.

If you are opening it with code such as the Click event of a command button:
1. Set the button's On Click property to:
[Event Procedure]

2. Click the Build button (...) beside that.
Access opens the code window.

3. Add the line to the event procedure, in between the "Private Sub..." and
"End Sub" lines.
 
G

Guest

duh...don't I feel stupid...

Thanks for your time and patience...

Steve



Allen Browne said:
The code does not go into the On Open property of the form.

Presumably the form is closed at the time you want to open it.

If you are opening it with code such as the Click event of a command button:
1. Set the button's On Click property to:
[Event Procedure]

2. Click the Build button (...) beside that.
Access opens the code window.

3. Add the line to the event procedure, in between the "Private Sub..." and
"End Sub" lines.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Shek5150 said:
When I entered the following command into the "On Open Event Property":

DoCmd.OpenForm "Frm_MethodCount", acFormDS

I get the following error message:

Run time error '2174'
You can't switch to a different view at this time

Was I correct to replace "Form1" w/ the actual name of my form? If so,
I'm
not sure why I'm getting the error message...

p.s., when I open the same form w/ a macro...it opens properly in
datasheet
view...

Steve
 

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