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.