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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Box commands

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
Hello, I have created an option box (Option87)in my access form and would like to make it work as follows:

If Option87 is pressed Then Do.....

Could someone help me with the syntax. I tried using:

(If Option87.Onclick ...) but it did not work.

Thank you!
 
You need to understand the Event model - it looks like you're about to program an endless loop checking for a change in the interface. In fact, it's all done for you. Bring up the Form in Design View and then double-click your Option Control. You'll then jump to the Code Module, and Access will automatically build an "OnClick" function for you. (probably something like..)
Code:
Sub Option87_OnClick()

End Sub
You can then place your code in the event procedure.

Hope this helps!
 
AT76 said:
I have created an option box (Option87)in my access form and would like to make it work as follows:
Is this Access or .NET?
If it is Access then here is something

Code:
Private Sub MychkBox_AfterUpdate()
    Select Case Me.MychkBox.Value
    Case -1
        Me.MyTextBox = Now
    Case 0
        Me.MyTextBox = ""
    End Select
End Sub

'=====================================
Private Sub MychkBox_AfterUpdate()
    If Me.MychkBox.Value = True Then
        Me.MyTextBox = Now
    Else
        Me.MyTextBox = ""
    End If
End Sub

You can do it either way.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Do not cut down the tree that gives you shade.
 
Thank you ZmrAbdulla! I will try what you suggest!

Best regards,

AT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top