How to Pass value selected in Option Group to Form in OpenArgs?

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 want to sort it, so I did an options group of 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
 

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