open in datasheet view

T

tina

Hi
I have a form which I have set properties default view as datasheet. this
then opens in correct view except when I use a command button to open form
from another form what code do I need to add to open in datasheet view
thanks
Tina
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "cost log"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command2_Click

End Sub
 
N

Nikos Yannacopoulos

Tina,

You just need one more parameter in the OpenForm command:

DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top