Datasheet View

  • Thread starter Ana via AccessMonster.com
  • Start date
A

Ana via AccessMonster.com

Hello!
I have a problem with form, because when I call form by itself, it is set to
Datasheet View, but when I call that same form with button on the Switchboard,
it opens in Form View. I want it to be seen in Datasheet view every time. In
properties I set it to Datasheet View, and other views to "no", but it
doesn't help me. So, my question is how to set my form, so when I call it by
pressing the button on the Switchboard, it opens in Datasheet View???
Thanks in advance!
 
D

Damon Heron

Check the code on your click event on the switchboard button. It should
read:
DoCmd.OpenForm stDocName, acFormDS
The acFormDS opens the form in Datasheet view.

Damon
 
F

fredg

Check the code on your click event on the switchboard button. It should
read:
DoCmd.OpenForm stDocName, acFormDS
The acFormDS opens the form in Datasheet view.

Damon


Regardless of how you have set up your form to open,
if you are opening it from an event on another form you
must specify Datasheet view:

DoCmd.OpenForm "FormName", acFormDS

I gather you are using the Microsoft Add-In switchboard.
Life would be simpler for you if you didn't, 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.

Which brings us back to your opening the form in datasheet view.
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 rs!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 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.
 
C

Confused87

I am having a similar problem, though I can't see where to put the string
suggested. I am using a form, not a switch board:


Option Compare Database

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "LINDEN Address Searching"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub


Cheers
C
 

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