Datasheet View

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
 
F

fredg

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
 
B

Bill Davis

Fred,
Thank you.. I did post the wrong code but you give me
what I was looking for "acFormDS".
 

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