Open Form From Command Button

T

TinleyParkILGal

I have a record entry form that I use in datasheet format to enter records. I
created a form to use as a menu with a command button that opens the record
entry form however when I open the form it does not open as a datasheet, but
rather a single form.

Is there a way to open the form in datasheet view through the command
button? I do not want to ever view the form in single form.

Thanks.
 
J

JoelH

the onClick event procedure of command button should read something
like:
docmd.OpenForm "your form's name", acFormDS

this stipulates that the form should be opened in datasheet view
 
F

fredg

I have a record entry form that I use in datasheet format to enter records. I
created a form to use as a menu with a command button that opens the record
entry form however when I open the form it does not open as a datasheet, but
rather a single form.

Is there a way to open the form in datasheet view through the command
button? I do not want to ever view the form in single form.

Thanks.

Regardless of the default view property of the form, to open a form in
datasheet view using code, you must explicitly open it in Datasheet
view.
Code a command button click event:
DoCmd.Openform "FormName", acFormDS
 
D

Dmackcwby

This information has been really helpful. However, no matter where I palce
the acFormDS command I keep getting an error. Can you help me? This is my
code:

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEditAttendance"

stLinkCriteria = "[FullName]=" & "'" & Me![FullName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub
 
A

Al Williams

I believe that the DoCmd should be:

DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria

HTH,

Al

This information has been really helpful. However, no matter where I palce
the acFormDS command I keep getting an error. Can you help me? This is my
code:

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEditAttendance"

stLinkCriteria = "[FullName]=" & "'" & Me![FullName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub

:

the onClick event procedure of command button should read something
like:
docmd.OpenForm "your form's name", acFormDS

this stipulates that the form should be opened in datasheet view
 
D

Dmackcwby

Thank you for the information. It worked perfectly.

Al Williams" <"atwms AT aol DOT com said:
I believe that the DoCmd should be:

DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria

HTH,

Al

This information has been really helpful. However, no matter where I palce
the acFormDS command I keep getting an error. Can you help me? This is my
code:

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEditAttendance"

stLinkCriteria = "[FullName]=" & "'" & Me![FullName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub

:

the onClick event procedure of command button should read something
like:
docmd.OpenForm "your form's name", acFormDS

this stipulates that the form should be opened in datasheet view
 
Top