|
-
Jun 26th, 2007, 04:18 PM
#1
Thread Starter
Lively Member
[RESOLVED] Option Button
HI i have a question
So i have 4 option( opt1, opt2, opt3, opt4) button each represent a option inside my database. and i'm reading these option into a recordset. So when i run the program, if the user chose a record the option button would be set to TRUE or False base on value in my databse.
here is my code:
Code:
Private Sub ListView1_DblClick()
If ListView1.ListItems.count > 0 Then
varFillCombo.MoveFirst
x = ListView1.SelectedItem.Index
varFillCombo.Move (x - 1)
If varFillCombo!Chamber = "CH1" Then
optCH1WP.Value = varFillCombo!Warn_Page
optCH1WE.Value = varFillCombo!Warn_Email
optCH1HP.Value = varFillCombo!Halt_Page
optCH1HE.Value = varFillCombo!Halt_Email
End If
'If Not IsNull(varFillCombo!Warn_Page) Then = varFillCombo!Name
End If
End Sub
Now when i'm stepping through the program n checking the GUI, the op1 one would set to true, then if opt2 was true, opt1 would be reset back to false, and opt2 set to true. But if opt3 was false then op2 would still be true. Then if opt4 was true then opt2 was reset back to false.
Does anyone know why it does this?
thank
Does anyone know y it does this?
Last edited by phimtau123; Jun 27th, 2007 at 01:39 PM.
-
Jun 26th, 2007, 06:01 PM
#2
Re: Option Button
Option buttons are used to present choices where only one item from a group may be chosen. Use checkboxes instead.
-
Jun 26th, 2007, 06:02 PM
#3
Re: Option Button
Use checkboxes rather than option buttons. With option buttons, the "true one" is exclusive within the group the contains the option buttons, which is why when one is set to true, all others in the group are set to false.
"It's cold gin time again ..."
Check out my website here.
-
Jun 26th, 2007, 10:48 PM
#4
Re: Option Button
Are you doing this with VBA or are you using VB6?
-
Jun 27th, 2007, 11:53 AM
#5
Thread Starter
Lively Member
Re: Option Button
i am doing this in vb6.
If i use the checked box, the value for check is 1, and the reference value i have in the database is either true or false. How would i go about setting this up?
vb Code:
Private Sub ListView1_DblClick()
If ListView1.ListItems.Count > 0 Then
varFillCombo.MoveFirst
x = ListView1.SelectedItem.Index
varFillCombo.Move (x - 1)
If varFillCombo!Chamber = "CH1" Then
If varFillCombo!warn_page = "True" Then
chkopt1.Value = 1
Else
chkopt1.Value = 0
End If
End If
End Sub
something like that for each of the box?
-
Jun 27th, 2007, 11:57 AM
#6
Re: Option Button
As was suggested, you should use checkboxes and in the code you show you are missing an End If.
-
Jun 27th, 2007, 12:07 PM
#7
Thread Starter
Lively Member
-
Jun 27th, 2007, 12:10 PM
#8
Re: [Resolve] Option Button
If we've helped you and you now have your answer, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|