Datasheet View with Command Buttons

mrichard1

New member
Local time
Today, 03:04
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
 
@JOWINO Welcome. You've been around for a while but this is just your second posting.

Access provides very good intellisense. When you type in a command, watch what Access shows you for options. This old thread didn't have a lot of posts so, people still looked at it once you revived it and so you were able to get an answer. However, no one wants to read through dozens of posts to get to your question so many will simply not open a thread with a large post count unless they've been participating all along. So, in the future, if you find a helpful thread as you did in this case but you can't implement it, start a new thread and post a link to the old thread so people can reference it if they want to.
 

Users who are viewing this thread

Back
Top Bottom