open form the way it was designed from the switchboard

G

Guest

Hi all,
I am trying to figure out a way, so when I press the button to open a form
on the switchboard, the form displayed is exactly how I designed it.
Right now, I have forms that are designed to display datasheet view and form
view. How do I write the code for the switchboard to open up in their own
respective views?
Thanks in advance!
Regards,
T
 
G

Guest

Thanks Allan and sorry, I must've phrased the quesiton wrong.

I have created a Switchboard with the help of the Access Switchboard
manager, and in the Switchboard I created items (buttons) to open up
different forms (datasheet view forms and single form view forms). Is there a
way that the Switchboard can open forms the way the forms are originally
designed?

thanks!
T
 
F

fredg

Hi all,
I am trying to figure out a way, so when I press the button to open a form
on the switchboard, the form displayed is exactly how I designed it.
Right now, I have forms that are designed to display datasheet view and form
view. How do I write the code for the switchboard to open up in their own
respective views?
Thanks in advance!
Regards,
T

Regardless of the Form's Default View setting, if you want to open a
form in Datasheet view using code, you must explicitly open it like
this:

DoCmd.OpenForm "FormName", acFormDS

otherwise it will open in Single Form View (or Continuous, if that is
the default view).
 
G

Guest

Thanks Fred
This is what the Switchboard code to open forms look like:

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

are you saying that I won't be able to open the forms the way they are
designed, unless I explicitly open the individual forms with the acFormDS,
acPreview...etc. ??
thanks!
regards,
T
 
F

fredg

Thanks Fred
This is what the Switchboard code to open forms look like:

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

are you saying that I won't be able to open the forms the way they are
designed, unless I explicitly open the individual forms with the acFormDS,
acPreview...etc. ??
thanks!
regards,
T

fredg said:
Regardless of the Form's Default View setting, if you want to open a
form in Datasheet view using code, you must explicitly open it like
this:

DoCmd.OpenForm "FormName", acFormDS

otherwise it will open in Single Form View (or Continuous, if that is
the default view).

You did not state that you are using the Access built-in switchboard.
That switchboard is a complex solution to a rather simple problem.
Life would be simpler for you if you didn't use it, 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.

However, if you use the built-in switchboard here is what you will
need to do.

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 rst!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 in Datasheet View from it's current number (either 2 or 3) to 9.

That should do it.
You cannot make or edit these changes using the Switchboard manager.
You must work around it, as above.

Best advice I can give you is to make your own switchboard form.
 
G

Guest

Thanks a whole bunch Fred! You are marvelous!

fredg said:
Thanks Fred
This is what the Switchboard code to open forms look like:

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

are you saying that I won't be able to open the forms the way they are
designed, unless I explicitly open the individual forms with the acFormDS,
acPreview...etc. ??
thanks!
regards,
T

fredg said:
On Mon, 25 Jul 2005 14:30:02 -0700, tracy wang wrote:

Hi all,
I am trying to figure out a way, so when I press the button to open a form
on the switchboard, the form displayed is exactly how I designed it.
Right now, I have forms that are designed to display datasheet view and form
view. How do I write the code for the switchboard to open up in their own
respective views?
Thanks in advance!
Regards,
T

Regardless of the Form's Default View setting, if you want to open a
form in Datasheet view using code, you must explicitly open it like
this:

DoCmd.OpenForm "FormName", acFormDS

otherwise it will open in Single Form View (or Continuous, if that is
the default view).

You did not state that you are using the Access built-in switchboard.
That switchboard is a complex solution to a rather simple problem.
Life would be simpler for you if you didn't use it, 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.

However, if you use the built-in switchboard here is what you will
need to do.

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 rst!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 in Datasheet View from it's current number (either 2 or 3) to 9.

That should do it.
You cannot make or edit these changes using the Switchboard manager.
You must work around it, as above.

Best advice I can give you is to make your own switchboard form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top