Form always open in 'Form View' when launched from Switchboard

  • Thread starter Thread starter Jon
  • Start date Start date
J

Jon

I have a form where both the Default View and Views
Allowed is set to Datasheet. However, when I launch the
form from the switchboard it always opens in Form View.
Any ideas how to make the form open in Datasheet View when
launching from the switchboard?

Thank you for your help!
 
I have a form where both the Default View and Views
Allowed is set to Datasheet. However, when I launch the
form from the switchboard it always opens in Form View.
Any ideas how to make the form open in Datasheet View when
launching from the switchboard?

Thank you for your help!

If you open a form from a command button on a different form, you must
always specify datasheet view, even if the default view of the form is
datasheet view.

DoCmd.OpenForm "FormName" , acFormDS
 
Okay, my second question is how do you make the
switchboard do that? The way the switchboard is
configured I don't see a convenient spot to place the code.
 
Hi Jon,

You have three options (at least) available to you.

1. You could make your form into a Continuous Form and
design it so it *looks* just like a datasheet. Then open
it in Edit mode from the Switchboard.

2. You could design your own "Switchboard-type" form and
launch all your procedures from there.

3. You can change the Switchboard code a little bit to
achieve your desired result. The Switchboard automatically
will open a form in Single view. If you change the code to
datasheet view then ALL forms will open in Datasheet view
which is probably not a good thing. If you would like to
have the best of both worlds, follow these instructions on
a BACK-UP COPY.

Open the Switchboard code. Find the area that has this:

' Constants for the commands that can be executed.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8

Add one more line to the list like this:

Const conCmdOpenFormDatasheet = 9

Now go a little further down the code until you come to
this area:

' Run code.
Case conCmdRunCode
Application.Run rst![Argument]

' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."

In between these two areas we want to add another one for
datasheet view. Add in this new code in the middle so it
looks like this:

' Run code.
Case conCmdRunCode
Application.Run rst![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rst![Argument], acFormDS

' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."

Compile and save the form.

Now you will NOT be able to use the Switchboard Wizard to
use this option. The Wizard will only use the 8 pre-
defined options. To open a form in Datasheet View you will
need to go directly to the Switchboard Items TABLE and add
it yourself. If you study the records you will figure out
what is going on. Just use the number 9 in the Command
field to open a form in datasheet view and showing all
records.

Hope that helps,
Jeff Conrad
Bend, Oregon
 
It looks like the switchboard does NOT allow you to use the default of a
datasheet view.

The solution is to simply use a continuous form. they look quite similar
anyway.

Perhaps even better is to dump the use of the switch board anyway. The
switch board is a very quick and dirty solution that you really should only
use when you are complete out of time....

I would consider making your own nice form, and they look a lot better
anyway. Here is example of one mine own switch boards...and the picture
changes each time you runt he program like some screen shots/screen savers
do:

http://www.attcanada.net/~kallal.msn/Rides/Rides.html

And, if you don't want to build your own custom switch board..then read the
following of mine that suggests that making custom menu bars is even better
and makes your software more user friendly.

http://www.attcanada.net/~kallal.msn/Articles/UseAbility/UserFriendly.htm
 
Thank you, gents. Very helpful. Jeff, thank you for the
detailed information and time spent answering my question.

- Jon
 
Okay, my second question is how do you make the
switchboard do that? The way the switchboard is
configured I don't see a convenient spot to place the code.
Jeff told you how-to add in the acFormDS if you are using the Access
Add-in switchboard.

Albert gave you even better advice.
Scrap that switchboard and create your own using an unbound form and
command buttons. If you add command buttons using the wizard, Access
will even write much of the code for you. Maintenance will be much
easier and you have more control over what the switchboard will do and
its appearance.
 
I am trying to find the code to open it up in form view. I dont want it to open up in datasheet view. What is the code to open it up in form view?
 
Back
Top