Datasheet/form view on opening

Jetjefferson

New member
Local time
Today, 18:45
Joined
Dec 12, 2007
Messages
8
I have made a database for recording contact with potential clients.

I have set up a button on the main form which opens up a second form which details dates and time of calls. In this second form I have placed a sub form to record notes of the conversations.

I set the second form up so that it views in Datasheet format with the sub form opening up in standard form view. This works ok when I open up from the main window.

However, when I use the button in the main form to open the call history form it opens the form in form view rather than datasheet view.

Can anybody help me to get it to open in datasheet view please.

The code I have behind the button is:

Private Sub Cont_History_Click()
On Error GoTo Err_Cont_History_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Contact Form"

stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Cont_History_Click:
Exit Sub

Err_Cont_History_Click:
MsgBox Err.Description
Resume Exit_Cont_History_Click

End Sub


Thanks

Derek
 
The second parameter of the DoCmd.Openform function is te way the form is openened, to open in table view it should look like:
Code:
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
 
Thanks Peter

That has done the trick.

Much appreciated

Derek
 

Users who are viewing this thread

Back
Top Bottom