Datasheet View

  • Thread starter Thread starter Bill Davis
  • Start date Start date
B

Bill Davis

I have a button on my form that I want to open my form
that is default to datasheet view but when it open it is
in Form Veiw. I have tried to change the view as in the
code but it does not give me and open for DataSheet view.
Please Help
Thanks in advance

Private Sub Command63_Click()
On Error GoTo Err_Command63_Click

Dim stDocName As String

stDocName = "qryDataView"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command63_Click:
Exit Sub

Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click

End Sub
 
I have a button on my form that I want to open my form
that is default to datasheet view but when it open it is
in Form Veiw. I have tried to change the view as in the
code but it does not give me and open for DataSheet view.
Please Help
Thanks in advance

Private Sub Command63_Click()
On Error GoTo Err_Command63_Click

Dim stDocName As String

stDocName = "qryDataView"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command63_Click:
Exit Sub

Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click

End Sub

I'm afraid I don't quite understand.
You write that you wish to open a form in Datasheet view using a
command button on a form, but the code you wrote is opening a query.

What is it you wish? To open a Query?
Your code does that. Click the button, the query will display.

Do you wish to open a form in datasheet view?
Regardless of how you set the Form's Default View property, it will
not open in Form Datasheet view if you open it from a command button,
UNLESS you specifically tell it to:
DoCmd.OpenForm "FormName", acFormDS
 
Fred,
Thank you.. I did post the wrong code but you give me
what I was looking for "acFormDS".
 
Back
Top