Setting Datasheet View

PatrickP

Patrick
Local time
Today, 21:11
Joined
Oct 11, 2007
Messages
4
I run a database for a Charity which records information submitted to us on paper forms.

One of the data entry forms on the database collects information about the Member who submitted the information and I wanted to add a Command button to this form which would display details about the Member's history with us just from typing a few characters of their name.

I did this by developing a form that displayed the required information in datasheet view and then added a Command button to the main data entry form (using the wizard for this) and set it to open the subsidiary form when the button was clicked. All quite simple.

This all works except for the fact that the form that opens when the button is clicked is always in Form View. I see from the Help files that the VB command for Open Form overrides whatever View may have been set in the design of the form that is being called but how do I get it to open the subsidiary form in Datasheet View?

Any help gratefully received.

Patrick
 
This question has been answered before but if you have not seen the post then use this code and see whether it works
Assuming your Command button is called cmdMemberHistory and Form is frmMember then

Private Sub cmdMemberHistory_Click()
On Error GoTo Err_cmdMemberHistory_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMember"


DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria

Exit_cmdMemberHistory_Click:
Exit Sub

Err_cmdMemberHistory_Click:
MsgBox Err.Description
Resume Exit_cmdMemberHistory_Click

End Sub
This opens the form in Data Sheet view regardless of the view set
 
This question has been answered before but if you have not seen the post then use this code and see whether it works..

That was brilliant. Thanks very much. My knowledge of VB is very limited and this has been so helpful. I am sorry if the answer was already in the postings but I didn't see it on first glance.

Thanks again

Patrick
 

Users who are viewing this thread

Back
Top Bottom