Callings from In design View from Switch Board

K

kash

Hi,

Below is the code that I used to call my Form in Design View from the
SwitchBoard. Where do I define the functions' name? Is it true that every
function should have a unique name if it is calling different tables? please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
N

Niklas Östergren

I´m not sure that I understand your Q. But you don´t have to, as far as I
know, to define the procedure (functions) name in any special place. You
just do it the way you have done:

Public Function OpenMyFormInDSView()

This line of code declare the name of your function to be
"OpenMyFormInDSView".

"Is it true that every function should have a unique name if it is calling
different tables?"

No it´s not! It depends on what your procedure is doing and how you have
written the code. If you have a generic procedure which takes a variable
holding the tables name you only need ONE procedure which can be called from
several places in you application. Like this:

Public Function ExportingTableData (strTableName As string) As Boolean

'Exporting data in table to a delimeter textfile
DoCmd.TransferText acExportDelim, , strTableName, , True

' Displaying msg to the user informaing that export was performed
MsgBox"Data in table " & strTableName & " was successfully exported."

'Returning result
ExportingTableData = True
End Sub

This procedure could then be called from several places in your code. What
you have to do is just to call it like this:

If ExportingTableData ("tblTableName") Then
' some code her
Else
' some other code here
End If

This is calling the procedure sending tablename [tblTableName] to the
procedure and if successfull then doing something else doing something else.

// Niklas
 
J

Jeff Conrad

Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.
 
T

tina

are you going to post a link to that, Jeff, and how can i make sure i don't
miss it? <rubs hands together in anticipation>


Jeff Conrad said:
Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.

--
Jeff Conrad
Access Junkie
Bend, Oregon

kash said:
Hi,

Below is the code that I used to call my Form in Design View from the
SwitchBoard. Where do I define the functions' name? Is it true that every
function should have a unique name if it is calling different tables? please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
J

Jeff Conrad

Hi Tina,

The add-in is finished and I have completed my very extensive and exhaustive testing. Right now I am
just finishing up a User's Guide to accompany the add-in. I might possibly have that finished in a
day or two. Then I send it off to MVP Sco to do so some additional beta testing and checking. He was
very helpful on one particular coding part so I promised him the "first look." If all looks good to
him then I will forward it on to Arvin and Dev. I'm hoping (and praying) they will agree to post it
on the Access Web. If they decline, Sco has already graciously agreed to post it on his web site.

--
Jeff Conrad
Access Junkie
Bend, Oregon

tina said:
are you going to post a link to that, Jeff, and how can i make sure i don't
miss it? <rubs hands together in anticipation>


Jeff Conrad said:
Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.

--
Jeff Conrad
Access Junkie
Bend, Oregon

kash said:
Hi,

Below is the code that I used to call my Form in Design View from the
SwitchBoard. Where do I define the functions' name? Is it true that every
function should have a unique name if it is calling different tables? please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
T

tina

cool! i don't know if i have Sco's website bookmarked. would you post a link
now, please? i'd like to check there and mvps.org in upcoming weeks - in
case i miss your post telling us the add-in is available. :)


Jeff Conrad said:
Hi Tina,

The add-in is finished and I have completed my very extensive and
exhaustive testing. Right now I am
just finishing up a User's Guide to accompany the add-in. I might possibly have that finished in a
day or two. Then I send it off to MVP Sco to do so some additional beta testing and checking. He was
very helpful on one particular coding part so I promised him the "first look." If all looks good to
him then I will forward it on to Arvin and Dev. I'm hoping (and praying) they will agree to post it
on the Access Web. If they decline, Sco has already graciously agreed to post it on his web site.

--
Jeff Conrad
Access Junkie
Bend, Oregon

tina said:
are you going to post a link to that, Jeff, and how can i make sure i don't
miss it? <rubs hands together in anticipation>


Jeff Conrad said:
Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.

--
Jeff Conrad
Access Junkie
Bend, Oregon

Hi,

Below is the code that I used to call my Form in Design View from the
SwitchBoard. Where do I define the functions' name? Is it true that every
function should have a unique name if it is calling different
tables?
please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
J

Jeff Conrad

Hi Tina,

You can find MVP Sco's site here:

http://www.scobiz.com

--
Jeff Conrad
Access Junkie
Bend, Oregon

tina said:
cool! i don't know if i have Sco's website bookmarked. would you post a link
now, please? i'd like to check there and mvps.org in upcoming weeks - in
case i miss your post telling us the add-in is available. :)


Jeff Conrad said:
Hi Tina,

The add-in is finished and I have completed my very extensive and
exhaustive testing. Right now I am
just finishing up a User's Guide to accompany the add-in. I might possibly have that finished in a
day or two. Then I send it off to MVP Sco to do so some additional beta testing and checking. He was
very helpful on one particular coding part so I promised him the "first look." If all looks good to
him then I will forward it on to Arvin and Dev. I'm hoping (and praying) they will agree to post it
on the Access Web. If they decline, Sco has already graciously agreed to post it on his web site.

--
Jeff Conrad
Access Junkie
Bend, Oregon

tina said:
are you going to post a link to that, Jeff, and how can i make sure i don't
miss it? <rubs hands together in anticipation>


Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.

--
Jeff Conrad
Access Junkie
Bend, Oregon

Hi,

Below is the code that I used to call my Form in Design View from the
SwitchBoard. Where do I define the functions' name? Is it true that
every
function should have a unique name if it is calling different tables?
please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
T

tina

thx! :)


Jeff Conrad said:
Hi Tina,

You can find MVP Sco's site here:

http://www.scobiz.com

--
Jeff Conrad
Access Junkie
Bend, Oregon

tina said:
cool! i don't know if i have Sco's website bookmarked. would you post a link
now, please? i'd like to check there and mvps.org in upcoming weeks - in
case i miss your post telling us the add-in is available. :)


Jeff Conrad said:
Hi Tina,

The add-in is finished and I have completed my very extensive and
exhaustive testing. Right now I am
just finishing up a User's Guide to accompany the add-in. I might
possibly
have that finished in a
day or two. Then I send it off to MVP Sco to do so some additional
beta
testing and checking. He was
very helpful on one particular coding part so I promised him the
"first
look." If all looks good to
him then I will forward it on to Arvin and Dev. I'm hoping (and
praying)
they will agree to post it
on the Access Web. If they decline, Sco has already graciously agreed
to
post it on his web site.
--
Jeff Conrad
Access Junkie
Bend, Oregon

are you going to post a link to that, Jeff, and how can i make sure
i
don't
miss it? <rubs hands together in anticipation>


Hi,

Design View and Datasheet View are two different things.
I assume by your code you meant to say open a form
in datasheet mode from the Switchboard.
I'm also assuming you are using the built-in Access
Switchboard Manager, correct?

Well very soon you'll hopefully be able to download my
Advanced Switchboard Manager Add-In which will take
care of this issue, as well as a bunch of other new tricks.
:)

In the meantime you have three options (at least)
available to you besides the coding option you are trying.
See if these options help.

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. Most, if not all, experts
prefer to build their own unbound forms for this purpose and
avoid using the 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
launched from the Switchboard 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.

--
Jeff Conrad
Access Junkie
Bend, Oregon

Hi,

Below is the code that I used to call my Form in Design View
from
the
SwitchBoard. Where do I define the functions' name? Is it true that
every
function should have a unique name if it is calling different tables?
please
help! Thanks!

Public Function OpenMyFormInDSView()

DoCmd.OpenForm "Quarter4_info_form_non_Edu", acFormDS

End Function
 
Top