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

Code for a toggle button, that connects with a text box, for a search

Status
Not open for further replies.

KaayJaay

IS-IT--Management
Jul 6, 2004
64
US
Im trying to write the code that basically states that if on toggle box is clicked(say apples and oranges) if apples is clicked, and in the text box, size is entered, then it will show me all apples bigger than the size specified in the text box, but if oranges is clicked it will show all oranges bigger than what is in the text box. I dont know how to write the VB code to do so. Any Suggestions?

KaayJaay
 
Take a look at the IIf function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I kinda know that IIf function, but i do not know VB so writing the entire onClick event is very difficult, I am trying to make it so that I can say if apples.focus = true, meaning it is clicked then do something. But im not sure how to write this code.

KaayJaay
 
Here is a sample of my attempt.

Private Sub Command135_Click()

If [Forms]![Repeats Interface]![Install].OnClick = True Then
DoCmd.OpenReport "Top 20 Installation Criteria", acViewPreview

ElseIf [Forms]![Repeats Interface]![Repair].OnClick = True Then
DoCmd.OpenReport "Top 20 Repair Criteria", acViewPreview

End If
End Sub

KaayJaay
 
I don't think the OnClick property is a good to test for your issue.
Which kind of control are Install and Repair ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
In an OptionGroup control ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I came up with this here, it runs but does not open the corresponding reports.

Private Sub Command135_Click()

If [Forms]![Repeats Interface]![Top20].OnClick = "Install" Then
DoCmd.OpenReport "Top 20 Installation Criteria", acViewPreview

ElseIf [Forms]![Repeats Interface]![Top20].OnClick = "Repair" Then
DoCmd.OpenReport "Top 20 Repair Criteria", acViewPreview

End If
End Sub
 
Test the value returned by the OptionGroup control.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
No F1 key on your keyboard ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top