Using Buttons to display datasheets

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I setup a form that has a button on it that runs a form. How can I get that
button to run the form, but display the results as a datasheet? If I click
on the form directly, it shows the datasheet. Using a button on another form
does not.
 
I setup a form that has a button on it that runs a form. How can I get that
button to run the form, but display the results as a datasheet? If I click
on the form directly, it shows the datasheet. Using a button on another form
does not.

Regardless of a form's Default View setting, if you wish to open it i
in Datasheet View using code you MUST specify Datasheet View.

DoCmd.OpenForm "FormName", acFormDS
 
Fred, thank you for your quick response. Where do I put the code?
DoCmd.OpenForm "H - Point Leaders", acFormDS.
 
Fred, thank you for your quick response. Where do I put the code?
DoCmd.OpenForm "H - Point Leaders", acFormDS.

From your previous message ...
" setup a form that has a button on it that runs a form. "

This is an already existing button on the form?
Open your form in design view.
Select the Command button you are using to open the form.
Display the Button's Property sheet.
Select the Event tab.
On the On Click event line it should say [Event Procedure].
Click on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens it will have some existing code that opens
the other form.
It will read something like:
DoCmd.OpenForm "H - Point Leaders"

Change that line to
DoCmd.OpenForm "H - Point Leaders", acFormDS
Save the changes.
 
Back
Top