FORM / DATASHEET VIEW

W

Wayne-I-M

You can use any of these formats when opening a form (there may be more -
not sure). Copied from the Help File

acDesign
acFormDS
acFormPivotChart
acFormPivotTable
acNormal
acPreview

So to open a form in Normal view use
DoCmd.OpenForm "Form_Name", acNormal, "", "", , acNormal


So to open a form in Datasheet view use
DoCmd.OpenForm "Form_Name", acFormDS, "", "", , acNormal

etc
etc

Note the 2nd acNormal is the window mode option

HTH
 
W

Wayne-I-M

Open your form (switchboard) in design view.
Create a new button
Right click and open the properties box
In the event column go to the OnClick row (or something else if thats what
you want)
Click build the build option (...)
select code
Insert the code line between the 2 lines the wizard will make for you like
this


Private Sub ButtonName_Click()
DoCmd.OpenForm "Form-Name", acFormDS, "", "", , acNormal
End Sub


Change the ButtonName and the Form-Name to what they really are on your form.
 
F

fredg

from the switchboard, is it possible to view the form opened in datasheet view?

I rather expect, from the wording of your message, that the
'switchboard' is the one created by the Access built-in switchboard
manager. If not, then Wayne's method is the one to use.

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

DoCmd.OpenForm "FormName", acFormDS

Life would be simpler for you if you didn't use the built-in
switchboard, but 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 first go into the Switchboard code window to 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 this change using the Switchboard manager.
You must work around it, as above.
 
W

Wayne-I-M

Thanks Fredg

I must admit I have never used the switchboard wizard so not really sure
what it produces. I will take look soon.
 
N

nomadk

tom-

In addition to Fred and Wayne's suggestions, if the datasheet is always your
preferred view for the form you can change its default:

Open the form in design view and from the Format tab of the Properties
window select Default View of "Datasheet".
 
L

Larry Linson

Wayne-I-M said:
Thanks Fredg

I must admit I have never used the switchboard wizard so not really sure
what it produces.

Ah, Wayne-I-M, you are a man of great perception and wisdom.
I will take look soon.

Ack, I may have to retract my previous statement, unless you mean "soon" in
the sense of the industry-standard "Real Soon Now", which means, in the
lifetime of some person now living, unless it is further delayed.

The Switchboard Manager is a complex solution to a simple problem, creating
objects and code that is very easy to accidentally make unworkable should
you open a form/module and make changes. Homegrown switchboards made with
unbound forms, command buttons, and possibly a few other controls are the
simple solution, do not require a cryptic and largely undocumented table.
If you need enough more capability that you think you need a table to
support it, you probably don't want the limited table of the Switchboard
Manager, anyway.

Larry Linson
Microsoft Office Access MVP
 

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