Datashhet View from another Form wont work

C

Confused87

I have a form which opens in Datasheet View, but then I have a command button
in another form and it only will open in form view. How do I get it to open
as a datasheet? I have gone to Properties and set Datasheet to yes and
everything else to no but it has made no difference. Here it is:



Option Compare Database

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "LINDEN Address Searching"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub


Any ideas?
Cheers
C
 
F

fredg

I have a form which opens in Datasheet View, but then I have a command button
in another form and it only will open in form view. How do I get it to open
as a datasheet? I have gone to Properties and set Datasheet to yes and
everything else to no but it has made no difference. Here it is:

Option Compare Database

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "LINDEN Address Searching"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Any ideas?
Cheers
C

Regardless of a form's Default View setting, if you wish to open that
form in Datasheet View using code you must specify Datasheet View.

DoCmd.OpenForm stDocName,acFormDS, , stLinkCriteria
 
C

Confused87

perfect, thanks (very new to this)

fredg said:
Regardless of a form's Default View setting, if you wish to open that
form in Datasheet View using code you must specify Datasheet View.

DoCmd.OpenForm stDocName,acFormDS, , stLinkCriteria
 

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