Datasheet View with Command Buttons

mrichard1

New member
Local time
Today, 02:47
Joined
May 11, 2007
Messages
6
I have a command button on my main form that displays information from another form. When I created the form that I want displayed, I created it in Datasheet view but when the form displays after the command button is clicked it displays only one record at a time. Is there anyway to display all the records in a datasheet view or similar instead of having to scroll through the records.
 
You need to change the default view of the form (in the form's properties dialog) to Datasheet from Single Form.
 
You need to change the default view of the form (in the form's properties dialog) to Datasheet from Single Form.

It is in Datasheet view in the Form but when you add a command button and open the form it no longer is in datasheet view.

Any ideas
 
You can't use buttons or other visual controls within datasheet views.
 
Behind the button on our main form use this code

DoCmd.OpenForm "YourSecondFormNameHere", acFormDS

This will force the form to open in datasheet view.
 
If you want a form that is in Datasheet view, but with command buttons, you will have to make a blank form, put your command buttons on it, then add your data form to this "blank" form as a subform. I set up and use a few of these for my stuff, and it works well.
 
want a form that is in Datasheet view, but with command buttons

He doesn't want a form in Datasheet view with command buttons, Joe, he wants a command button that would open a form in Datasheet View, which is what the code I posted will do. When opening a form from a command button, you have to explicitly call it using acFormDS for it to open in Datasheet View, even if the form was created using Datasheet View as the default! Ain't Access grand?
 
Behind the button on our main form use this code

DoCmd.OpenForm "YourSecondFormNameHere", acFormDS

This will force the form to open in datasheet view.
I have this code that opens a datasheet form
DoCmd.OpenForm "ACCOUNT_TYPE_DATA_FORM", acViewForm, , "[ACCOUNT_TYPE] = '" & Me.ACCOUNT_TYPE & "'"
How do I add , acFormDS, at the end.
Because I have tried I almost panicked.
 
You do not, you use it as shown. :(
 
@JOWINO Just as a comment- please don’t hijack a 17 year old thread, start your own
 

Users who are viewing this thread

Back
Top Bottom