Q: with a form display

  • Thread starter Thread starter Troy
  • Start date Start date
T

Troy

Hello,

I designed a form to be displayed in spreasheet format and works fine when
selected directly. However, when it is selected from the "Switchboard Item",
the same form is display as a Continuous but not as spreadsheet. I cannot
figure out why.

Any help is appreciated.

TIA

Troy
 
You want the form to be displayed "in datasheet mode", not "as a
spreadsheet".

The code in the switchboard form's code module will have a line like:
DoCmd.OpenForm which opens the selected form. There is an OpenForm
parameter to select what "view" the form should open in. One of the views,
is datasheet view. Check out online help on OpenForm, for more information.

HTH,
TC
 
Thank you for getting back to me.

The control panel taken from Northwind has the following syntax:

Case conCmdOpenFormAdd
DoCmd.OpenForm rs![Argument], , , , acAdd

and I changed it to:

DoCmd.OpenForm rs![Argument], , , , acFormDS

but still doesn't open it in datasheet mode.
 
Sorry, not sure why that wouldn't work, & I don't have Access on this PC, to
check it myself. Double-check (in online help) that acFormDS is the right
setting name, & that you have it in the right position in the parameter list
of the OpenForm call. Apart from that, I'm not sure what to suggest :-(

HTH,
TC


Troy said:
Thank you for getting back to me.

The control panel taken from Northwind has the following syntax:

Case conCmdOpenFormAdd
DoCmd.OpenForm rs![Argument], , , , acAdd

and I changed it to:

DoCmd.OpenForm rs![Argument], , , , acFormDS

but still doesn't open it in datasheet mode.


TC said:
You want the form to be displayed "in datasheet mode", not "as a
spreadsheet".

The code in the switchboard form's code module will have a line like:
DoCmd.OpenForm which opens the selected form. There is an OpenForm
parameter to select what "view" the form should open in. One of the views,
is datasheet view. Check out online help on OpenForm, for more information.

HTH,
TC
 
Your syntax is close, but not quite right.

You would need to change the Switchboard code to this
syntax in order to open the form in Datasheet mode:

' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], acFormDS, , , acFormAdd

' Open a form in Edit mode.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument], acFormDS, , , acFormEdit

However, you must realize that doing this will make ALL
forms opened from the Switchboard be in Datasheet view.
Let me provide some other thoughts on this subject.

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 Add/Edit mode from the Switchboard.

2. You could design your own "Switchboard-type" form and
launch all your procedures from there. The experts never
use the built-in Switchboard Manager.

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. If you want to open it in Add mode only, just
create another item number 10 and use the appropriate
syntax in the code.

--
Jeff Conrad
Access Junkie
Bend, Oregon
-----Original Message-----
Thank you for getting back to me.

The control panel taken from Northwind has the following syntax:

Case conCmdOpenFormAdd
DoCmd.OpenForm rs![Argument], , , , acAdd

and I changed it to:

DoCmd.OpenForm rs![Argument], , , , acFormDS

but still doesn't open it in datasheet mode.


TC said:
You want the form to be displayed "in datasheet mode", not "as a
spreadsheet".

The code in the switchboard form's code module will have a line like:
DoCmd.OpenForm which opens the selected form. There is an OpenForm
parameter to select what "view" the form should open in. One of the views,
is datasheet view. Check out online help on OpenForm,
for more
information.
format and works fine
when
the "Switchboard
Item",
spreadsheet. I
cannot
 
Back
Top