Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Group- how to reference

Status
Not open for further replies.

MsMope

IS-IT--Management
Sep 3, 2003
83
US
Good Morning,
I have three option buttons on a form stored within a frame
I want to reference them such as:
If opt70 is chose then
do commands
else if opt140 is chose then
do commands
else
do commands
end if.
This is how I currently have it, but the frmDelivery.Value is obviously not the right choice because I cannot change the selection on the form, which is defaulted in based on account

Code:
Private Sub frmDelivery_AfterUpdate()
Dim strSQL As String
Dim strJobID As String
Dim db As Database, rs As Recordset
Select Case frmDelivery.Value
    Case 1
        Set db = CurrentDb
        strSQL = "UPDATE user_tblJobProp" & " " & _
                   "SET user_tblJobProp.[Delivery_Value]= 1" & " " & _
                    "where user_tblJobProp.[ID]= '" & is_modoutline_getcurrentid() & "'"
            DoCmd.RunSQL strSQL
      
          Debug.Print strSQL
    Case 2
        strSQL = "UPDATE user_tblJobProp" & " " & _
                   "SET user_tblJobProp.[Delivery_Value]= 2" & " " & _
                    "where user_tblJobProp.[ID]= '" & is_modoutline_getcurrentid() & "'"
            DoCmd.RunSQL strSQL
    Case 3
         strSQL = "UPDATE user_tblJobProp" & " " & _
                   "SET user_tblJobProp.[Delivery_Value]= 3" & " " & _
                    "where user_tblJobProp.[ID]= '" & is_modoutline_getcurrentid() & "'"
            DoCmd.RunSQL strSQL
    Case Else
         Frame6.Value = Null
  End Select
End Sub
 
MsMope
To reference the option group with Select Case, you select the Frame.

Here's an example from one of my databases...
Select Case [FrameMembers]
Case Is = 1
DoCmd.OpenReport "rptMembers", acViewPreview
Case Is = 2
DoCmd.OpenReport "rptMembersContactData", acViewPreview
Case Is = 3
DoCmd.OpenReport "rptBoard", acViewPreview
Case Is = 4
DoCmd.OpenReport "rptBoardContactData", acViewPreview
Case Is = 5
DoCmd.OpenReport "rptBoardTerms", acViewPreview
End Select
Me.FrameMembers = Null

I set the frame to Null at the end because there are several option frames on the form.

Hope that helps.

Tom
 
yep that works
do you have your frame bound to a field?
 
And that is how I reference which button is chose within the frame?
 
MsMope
The frame is an Option Group on an unbound form. It is not bound to a field.

You refer to the options within the group just the way I have shown.

You, of course, will have to put in your own frame name, DoCmd expressions etc.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top