Option Buttons

Infinite

More left to learn.
Local time
Today, 11:36
Joined
Mar 16, 2015
Messages
402
Could any one explain how to use option buttons? I've looked around, but I cant find any site, thread, etc, etc on how to fully use them. I have 3 option buttons,
there "Retired" "Current" and "Not Stocking"
I want them to be tied the the list box named "lstItems" that gets its info from a qryItems. Any help would be greatly appreciated :)
 
option buttons are best inside a frame/option group

they work as radio buttons, so only one can be pressed at a time. They each have a numeric value (1,2,3 etc), and the "value" of the entire option group (1,2 or 3) corresponds to the selected radio button.

Just put an option group on your form, and follow the wizard to see how it works.
 
I did that, but im not sure how to tell it that the option group is associated with the list.
 
So, how would I go about doing that? Creating the option button for my lstbox, that is.
 
The reason I am asking is because in the attached data base (And I have NO idea were I got it from) has option groups that do what I want (minis the whine part of course :) Im just trying to figure out how, its got code, and I changed there words with mine, but im not sure what the data(1) is for.
 
Last edited:
option buttons are best inside a frame/option group

they work as radio buttons, so only one can be pressed at a time. They each have a numeric value (1,2,3 etc), and the "value" of the entire option group (1,2 or 3) corresponds to the selected radio button.

Just put an option group on your form, and follow the wizard to see how it works.
__________________


Ok, then my new question should be how to use Frame/Option groups...Not how to use option buttons. But, asides from that, back to what I was saying, I just want to know how use them.
 
I looked at that, and I didn't get anything from it really, because its not telling me what to do. E.G, what code to write.
 
Code:
Private Sub Frame125_Click()

Select Case 1
      Case 1
MsgBox "Your credentials have been checked."

      Case 2
      MsgBox "Test"
     Case 3
     MsgBox "Again"
    


End Select
End Sub

So far, that is what I have, but if I select case 1, if says the the credentials thing, and if I select case 2, it says the same thing as if I selected case 1.
 
double check the values of the buttons. they should be 1,2 and 3. If two buttons are set to the same value you will get strange results. You will see a green indicator in design mode if there is a problem with the values.
 
No, there option values are 1, 2, and 3.
 
The statement is

Select Case <controlname>

Something like

Code:
Private Sub Frame16_Click()
Select Case Frame16
    Case 1
        MsgBox "Red"
    Case 2
        MsgBox "White"
    Case 3
        MsgBox "Rose"

End Select

End Sub

That database you posted just uses the relevant values selected in a query when searching for the wines, so nothing to see in code.
 
The statement is

Select Case <controlname>

Something like

Code:
Private Sub Frame16_Click()
Select Case Frame16
    Case 1
        MsgBox "Red"
    Case 2
        MsgBox "White"
    Case 3
        MsgBox "Rose"

End Select

End Sub
That database you posted just uses the relevant values selected in a query when searching for the wines, so nothing to see in code.

good spot. you can miss the obvious things, can't you. The OP had
select case 1
 
The OP had
select case 1

What do you mean?


That database you posted just uses the relevant values selected in a query when searching for the wines, so nothing to see in code.

Code:
Like "*" & [forms]![FRM_SearchMulti]![frame50] & "*"

I would use that, just change the wording, correct?
 
I got this


Code:
Private Sub Frame16_Click()
    Me.lstItems.Requery
    Me.lstItems = Me.lstItems.ItemData(1)

    

End Sub

in the option group on click. And I have this


Code:
Like "*" & [forms]![frmItems]![frame16] & "*"

in the query's Criteria section. But, when I click the option groups, all that happens is it doesnt show any results in the list box.
 
What exactly are you trying to achieve.?

Is the query you mention the query for the lstItems source?

What option buttons do you have in Frame16?
 
What exactly are you trying to achieve.?

A fully working option button.

Is the query you mention the query for the lstItems source?

its (if im reading what your saying correct) qryItems.

What option buttons do you have in Frame16?

3 of them. 1 is Retired, 2 is current, and 3 is Not Stocking.
 
A fully working option button.


its (if im reading what your saying correct) qryItems.


3 of them. 1 is Retired, 2 is current, and 3 is Not Stocking.

Well I would start with the basics.

Does lstItems have values to start with supplied by qryItems BEFORE you try starting to filter the results.?

Your syntax appears to expect numeric values for the option. Or have you just copied the syntax from that wine db.?

That database had the wine colours as numerical values in the database and filtered on what was selected. Are you fields in the query numeric or character?

So I would ensure you get ALL items in the listbox first, then add criteria for the option buttons.
 
Ok, here is my data base (or the parts you need) and in the frmItems you can double click on the item to edit it, but in frmItems I want a option group. As you can see, I have the start for one, but it doesnt work for a reason I do not know. Don't judge me yet, :) I haven't finished the data base, I have lots of excess query's, tables, forms, etc, etc.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom