Calling forms using Switchboard

  • Thread starter Thread starter Guest
  • Start date Start date
Your question is rather short on details. Assuming that you can already open
the form from the switchboard, open the form in design view. Double click the
little box at the very top left corner to open the form's property sheet.
Click the format tab and change the default view to Datasheet. If you need
to add to the switchboard a command button for opening the form you could use
the wizard (see Help for details). If you need the option of opening the
form in different views you can use code, but I will wait to see if you
specify that requirement.
 
Hi,

The way I do it is:

Create a Function in a Code Module and run the function from the switchboard
(Run Code command).

The code would be something like:

Public Function OpenMyFormInDSView

DoCmd.OpenForm "frmName", acFormDS

End Function


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
 
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.
 
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.
 
I was just having this exact problem and found your post. Excellent and
thoroughly researched process. Thank you!!!
--
THX cs


NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




NewSysAdmin said:
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.
 
This is very helpful. But, for those of us who don't usually write code. To
do this go to "Tools, Macro, Visual Basic Editor". After Visual Basic Editor
opens, find the "Form_Switchboard" then begin scrolling through to find the
codes.

Thanks you!!!

Cydney said:
I was just having this exact problem and found your post. Excellent and
thoroughly researched process. Thank you!!!
--
THX cs


NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




NewSysAdmin said:
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.

:

Hi,

The way I do it is:

Create a Function in a Code Module and run the function from the switchboard
(Run Code command).

The code would be something like:

Public Function OpenMyFormInDSView

DoCmd.OpenForm "frmName", acFormDS

End Function


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
How can I call a form in a Datasheet View using a Switchboard?
 
I am totally confused, and having this same problem.

Looking at the code, I already have a #9, for "Const conCmdOpenPage".

I tried to insert a new line as #10 for "Const conCmdOpenFormDatasheet: but
no luck.

Please help!



NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




NewSysAdmin said:
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.
 
Thanks for the post, Same issue in 2007 and I believe thius will help me to
solve.Thanks again.

NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




NewSysAdmin said:
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.
 
Thanks for the tip, I too don't usually use teh coding method; therefore your
tip was a big help!

Ahoy said:
This is very helpful. But, for those of us who don't usually write code. To
do this go to "Tools, Macro, Visual Basic Editor". After Visual Basic Editor
opens, find the "Form_Switchboard" then begin scrolling through to find the
codes.

Thanks you!!!

Cydney said:
I was just having this exact problem and found your post. Excellent and
thoroughly researched process. Thank you!!!
--
THX cs


NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




:

I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.

:

Hi,

The way I do it is:

Create a Function in a Code Module and run the function from the switchboard
(Run Code command).

The code would be something like:

Public Function OpenMyFormInDSView

DoCmd.OpenForm "frmName", acFormDS

End Function


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
How can I call a form in a Datasheet View using a Switchboard?
 
Thanks for posting that! I too would have tried the 10 and become frustrated.
After reading your post, I tried "A" thinking of teh old bexadecimal
numbering scheme. Unfortunately that did not work because teh Switchboard
form table expects a numeric entryin that field.

I did get around teh issue by using the ninth option which was designed for
access page. Since my application does not use the access page, I simoply
remarked out the code dealing with access page and inserted the openForm in
datasheet cview code below it!

Worked great!

GoBrowns! said:
I am totally confused, and having this same problem.

Looking at the code, I already have a #9, for "Const conCmdOpenPage".

I tried to insert a new line as #10 for "Const conCmdOpenFormDatasheet: but
no luck.

Please help!



NewSysAdmin said:
I know how reliant you can become on message boards when you have a problem
that you're stuck on, so I'm posting the following solution. Sorry, I posted
the previous response without testing it fully. My previous post appears to
work until you try another page of the Switchboard, when you click the 6th
and 7th buttons, it does the same thing (tries to open a form in datasheet
view), which I did not want. Please see below for the solution I found that
REALLY WORKS (found on another discussion board posted by Jeff Conrad.) It
involves changing the Switchboard code.

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 rs![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 rs![Argument]

' Open a form in Datasheet Mode.
Case conCmdOpenFormDatasheet
DoCmd.OpenForm rs![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.




NewSysAdmin said:
I tried the previous post, and it gave me an error executing the command. By
searching another message board, I found this solution. I added the below
code to the button which the user would click to open the form in datasheet
mode. I put it into an Event Procedure called by the On Click Event.

Private Sub Option6_Click()

DoCmd.OpenForm "Form Name here", acFormDS

End Sub

This worked for me, and seemed to be a very simple fix.

:

Hi,

The way I do it is:

Create a Function in a Code Module and run the function from the switchboard
(Run Code command).

The code would be something like:

Public Function OpenMyFormInDSView

DoCmd.OpenForm "frmName", acFormDS

End Function


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
How can I call a form in a Datasheet View using a Switchboard?
 
Back
Top