471,066 Members | 969 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

Option Groups

Is there anyway of returning the value of an option group (in access 2003) back to what it was before any entry was made? I frequenty find people are wishing to remove there answer but with an option group it seems as if once you have made a choice, although you can change the choice, there is no way of returning it to its original state of having nothing selected. I know I can do this with a combo box by simply deleting the entry but I was hoping it could also be done with an option group. Any help appreciated
Oct 14 '08 #1
3 5728
Stewart Ross
2,545 Expert Mod 2GB
Hi BarbaraB, and Welcome to Bytes!

Depending on what you want to do there are several ways to revert the option group back. One is to reset the value of the option group to the DefaultValue property of the frame concerned. You can test this by placing the following line in the On Click code of a suitable button:

Expand|Select|Wrap|Line Numbers
  1. me![name of your option group] = me![name of your option group].DefaultValue
You can also clear the option group completely (no default choice displayed) by setting it to null:

Expand|Select|Wrap|Line Numbers
  1. me![name of your option group] = Null
-Stewart
Oct 14 '08 #2
Thanks, worked a treat. A nice simple solution.
Oct 14 '08 #3
byronh
1
Hi, first time posting here and hope this question hasn't already been answered elsewhere. Got frame and option group help from Martin Green's Access Tips to create an action tracking option group to filter records for a report.

The options for the "Apply Filter" button for filtering on the Action Status are: Open, Closed, Late, Overdue and All.

Everything works fine for the filter except that for viewing Open actions, I would like to see both Open and Overdue actions as no action can be Overdue (for closure) without also being Open.

I have amended the Martin Green code accordingly and here it is below:

Private Sub cmdApplyFilter_Click()
Dim strSource As String
Dim strOwner As String
Dim strContract As String
Dim strDivision As String
Dim strStatus As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rptMainData") <> acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string for Source field
If IsNull(cboSource.Value) Then
strSource = "Like '*'"
Else
strSource = "='" & cboSource.Value & "'"
End If
' Build criteria string for Owner field
If IsNull(cboOwner.Value) Then
strOwner = "Like '*'"
Else
strOwner = "='" & cboOwner.Value & "'"
End If
' Build criteria string for Contract field
If IsNull(cboContract.Value) Then
strContract = "Like '*'"
Else
strContract = "='" & cboContract.Value & "'"
End If
' Build criteria string for Division field
If IsNull(cboDivision.Value) Then
strDivision = "Like '*'"
Else
strDivision = "='" & cboDivision.Value & "'"
End If
' Build criteria string for Status field
Select Case fraStatus.Value
Case 1
strStatus = "='Open'"
Case 2
strStatus = "='Closed'"
Case 3
strStatus = "='Late'"
Case 4
strStatus = "='Overdue'"
Case 5
strStatus = "Like '*'"
End Select
' Combine criteria strings into a WHERE clause for the filter
strFilter = "[Contract] " & strContract & " AND [Source] " & strSource & " AND [Owner] " & strOwner _
& " AND [Division] " & strDivision & " AND [Status] " & strStatus
' Apply the filter and switch it on
With Reports![rptMainData]
.Filter = strFilter
.FilterOn = True
.txtReportSubtitle.Value = _
"Division: " & cboDivision.Value
End With


All assistance much appreciated,
Byron
Jan 19 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Saxman | last post: by
10 posts views Thread by David | last post: by
4 posts views Thread by Y Plas | last post: by
20 posts views Thread by PC Datasheet | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.