D
dohernan
I have a form in access 2003 with a button that opens up another form in
Datasheet view. Before people view the spreadsheet, I want them to choose
how they wish to sort it.
I did an Options Group with 3 choices.
I don't know how to feed these options to the opening Form/Spreadsheet...
"Pass the value selected in the option group to the new form in the OpenArgs
argument of the OpenForm method."
Help please? Thanks.
Klatuu was kind enough to say-
In the Load event of the datasheet form, set the form's Order By property
using the value received in the option group.
If Not IsNull(Me.OpenArgs) Then
Select Case Me.OpenArgs
Case 1
Me.OrderBy = "[Last name], [First name], [date received]"
Case 2
Me.OrderBy = "[date received].[Last name], [First name]"
Case 3
Me.OrderBy = "[date completed].[Last name], [First name]"
End Select
End If
+++++
My current Opening button-
+++++
Private Sub Command53_Click()
End Sub
Private Sub CommandSpreadsheetOpen_Click()
On Error GoTo Err_CommandSpreadsheetOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Personnel2009Spreadsheet"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CommandSpreadsheetOpen_Click:
Exit Sub
Err_CommandSpreadsheetOpen_Click:
MsgBox Err.Description
Resume Exit_CommandSpreadsheetOpen_Click
End Sub
Datasheet view. Before people view the spreadsheet, I want them to choose
how they wish to sort it.
I did an Options Group with 3 choices.
I don't know how to feed these options to the opening Form/Spreadsheet...
"Pass the value selected in the option group to the new form in the OpenArgs
argument of the OpenForm method."
Help please? Thanks.
Klatuu was kind enough to say-
In the Load event of the datasheet form, set the form's Order By property
using the value received in the option group.
If Not IsNull(Me.OpenArgs) Then
Select Case Me.OpenArgs
Case 1
Me.OrderBy = "[Last name], [First name], [date received]"
Case 2
Me.OrderBy = "[date received].[Last name], [First name]"
Case 3
Me.OrderBy = "[date completed].[Last name], [First name]"
End Select
End If
+++++
My current Opening button-
+++++
Private Sub Command53_Click()
End Sub
Private Sub CommandSpreadsheetOpen_Click()
On Error GoTo Err_CommandSpreadsheetOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Personnel2009Spreadsheet"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CommandSpreadsheetOpen_Click:
Exit Sub
Err_CommandSpreadsheetOpen_Click:
MsgBox Err.Description
Resume Exit_CommandSpreadsheetOpen_Click
End Sub