Changing the view.

C

ChAcessN00b

Help, I have the default view in my form set to datasheet view, However when
i run the form from my switch board "open form in edit mode" it always opens
in the form view. I would like it to open in Datasheet view. Is there as
macro or property that i am overlooking?
 
F

fredg

Help, I have the default view in my form set to datasheet view, However when
i run the form from my switch board "open form in edit mode" it always opens
in the form view. I would like it to open in Datasheet view. Is there as
macro or property that i am overlooking?

Regardless of how you have set up your form to open,
if you are opening it from an event on another form you
must specify Datasheet view:

DoCmd.OpenForm "FormName", acFormDS

However, I gather you are using the Microsoft Add-In switchboard.
Life would be simpler for you if you didn't, and made use of an
unbound form with command buttons.
Much more versatile, and easier to maintain.
And Access will write most of the code if you use the command button
wizard.

To use the built-in switchboard to open a form in datasheet view,
you'll need to go into the Switchboard code window and add some code.

Open the Switchboard Code window.

Find the
Private Function HandleButtonClick(intBtn As Integer)
code line.
A few lines down you'll find the Constants listed.
Add
Const conCmdOpenFormDS = 9
at the end of the list (I believe there are originally just 8
constants).

Then go down further into the Select Case statements.
Add:

Case conCmdOpenFormDS
DoCmd.OpenForm rs!Argument, acFormDS

just before the Case Else statement.

Close the code window.

Open the Switchboard Items table.
Change the Command value for the form you wish to
open from it's current number (either 2 or 3) to 9.

That should do it.
You cannot make or edit this change using the Switchboard manager.
You must work around it, as above.

Best advice I can give you is to make your own switchboard form.
 
C

ChAcessN00b

Alright i realize now that making my own customized form with command buttons
is much easier and better for later use when someone else uses my database.
However there was the function "Open form in Add mode" that one was very
useful for some forms, but not needed in other forms. With the command button
i have gone through the wizard and dont quite know how to make it open in add
form.

Ch
 
C

ChAcessN00b

After going through some trial runs with the built in switch board and going
through the codes and looking at it i figured how to do it. thanks a million
helps ALOT
 
F

fredg

Alright i realize now that making my own customized form with command buttons
is much easier and better for later use when someone else uses my database.
However there was the function "Open form in Add mode" that one was very
useful for some forms, but not needed in other forms. With the command button
i have gone through the wizard and dont quite know how to make it open in add
form.

Ch

Open the Switchboard Items table.
Change the Command value for the form you wish to
open from it's current number (either 2 or 3) to 9.

Look in the Code and you will see,under
Private Function HandleButtonClick(intBtn As Integer)

Const conCmdOpenFormAdd = 2

Open the Switchboard Items table.
Change the Command value for the form you wish to
open from it's current number to 2.
 

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