Default datasheet view doesnt open

lowanam1

Registered User.
Local time
Today, 10:56
Joined
Jan 13, 2012
Messages
106
From the switchboard I can not get forms to open in the datasheet view. I have it set as the default view but it still opens in the form view. Does anyone know the code? and if so, where do I put the code. Thank you :confused:
 
yes a button from the switchboard.
 
Now I haven't really used the Switchboard Manager but I know gemma-the-husky or Galaxiom(AtHome) have used it extensively.

Can you get to the code?
 
Howzit

The only way I have been able to do it (without changing the default switchboard settings) is by using a macro to open the form - where you can specify the view type, and in the Switchboard use "Run Macro" instead of "Open Form...

I'm sure there is a cleaner way, and woiuld be interested in finding the answer
 
Below is the code that needs to be changed to open the form in the datasheet view: I just don't know where to change the code. Can anyone help and advise how to find where to change the code?

DoCmd.OpenForm stDocName, acNormal, , , , acDialog


DoCmd.OpenForm stDocName, acFormDS, , , , acDialog
 
Howzit

The code behind the switchboard does not provide the View Type argument I believe, therefore the default Form view is used overriding the setting on the target form.

You would need to change the code behind the switchboard (which I would not recommend), sorry I know not where or follow my earlier example by creating a macro to open the form where you can specify datasheet view.

If you change the code behind the switchboard this will apply to all forms I think.
 
I have 50 forms on the switchboard. I would have to redo my entire switchboard to run macros and I dont really want to do that.....
 
Howzit

Do all your forms open in datasheet view?
 
Howzit

I did some googling on this and if you wanted to change the switchboard code you need to change the below.

Code:
DoCmd.OpenForm rs![Argument]

to:

Code:
DoCmd.OpenForm rs![Argument], acFormDS
 
Below is the code that needs to be changed to open the form in the datasheet view: I just don't know where to change the code. Can anyone help and advise how to find where to change the code?

DoCmd.OpenForm stDocName, acNormal, , , , acDialog


DoCmd.OpenForm stDocName, acFormDS, , , , acDialog
I would imagine the Switchboard has a form. Open the Switchboard in Design and look for the code that opens the form, add the acFormDS constant in the parameter as you have it above.
 
Right..from the design view how do I find the code? Thanks
 
Howzit

From the Event tab of the properties sheet, click on one of the fields that have an Event Procedure, an elipses button will show, click that and this will open the VBA screen where you can then scroll down to find the relevant code that you need to change.
 
  • Open the Switchboard Form in Design View
  • Right Click the appropriate Button
  • Click on Properties
  • Click on Events
In the OnClick event you'll see

=HandleButtonClick(X)

where X is the Button Number for the Button in question.

  • Click to the Right of the box and select [Event Procedure] using the arrow
  • DoubleClick on the ellipsis (...)
you should now see
Code:
Private Sub Option[B][I]X[/I][/B]_Click()

End Sub
Add this line

DoCmd.OpenForm "YourFormName", acFormDS

replacing YourFormName with the actual name of your Form, so you now have
Code:
Private Sub Option[B][I]X[/I][/B]_Click()
 DoCmd.OpenForm "YourFormName", acFormDS
End Sub

You should now be set. The limited options inherent in the Switchboard Manager generated Switchboard Form is why most experienced developers shun it and create custom Forms to use as Switchboards.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom