open in datasheet view

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Tina,

You just need one more parameter in the OpenForm command:

DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria

HTH,
Nikos
 
Back
Top