 |
| VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 12th, 2005, 02:00 PM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Disable Check Boxes
Hello,
I need help with disabling one check box when another checkbox is selected on a form I built in Access?
|
|

July 12th, 2005, 03:30 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
This is easiest if you use radio buttons (the round dealies with a dot in the middle), and put several of then into a frame. If one is selected, the others are automatically cleared.
|
|

July 13th, 2005, 08:38 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you for your help, but my customer requested checkboxes.
|
|

July 13th, 2005, 08:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi there..
just put in the click event some code to disable the rest of the checks...
you have to do this for every check box...
HTH
Gonzalo
|
|

July 13th, 2005, 09:29 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is the code I came up with so far but its not working.
Private Sub GBP_Click()
If Me.GBP.Value = True Then
Me.EURO.Enabled = False
Else
Me.EURO.Enabled = True
End If
End Sub
Private Sub EURO_Click()
If Me.EURO.Value = True Then
Me.GBP.Enabled = False
Else
Me.GBP.Enabled = True
End If
End Sub
|
|

July 13th, 2005, 09:41 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi..
you dont have to use the disable property, use the value property and set it to false.
HTH
Gonzalo
|
|

July 13th, 2005, 10:22 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I switched the code and its still not working, maybe the rest of the code for this from will help.
Option Compare Database
Private Sub EURO_Click()
If Me.EURO.Value = True Then
Me.GBP.Value = False
Else
Me.GBP.Value = False
End If
End Sub
Private Sub Form_Click()
End Sub
Private Sub Form_Close()
Forms![Invoice Navigator].List0 = ""
Forms![Invoice Navigator].List3 = ""
[Form_Invoice Navigator].Refresh
End Sub
Private Sub Form_Current()
'disable editing if contract is closed
If Me.Closed.Value = True Then
Me.AllowEdits = False
Me.lblContractClosed.Visible = True
Else
Me.AllowEdits = True
Me.lblContractClosed.Visible = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
'disable editing if contract is closed
If Me.Closed.Value = True Then
Me.AllowEdits = False
Me.lblContractClosed.Visible = True
Else
Me.AllowEdits = True
Me.lblContractClosed.Visible = False
End If
'If EURO is chcked display EURO on invoice form
If Forms![Invoice Scanner].EURO = True Then
Forms![Invoice Scanner]!InvSub.Form!CurPayIn = "EURO"
End If
' If GBP is checked on the contracts then display GBP on Invoice
If Forms![Invoice Scanner].GBP = True Then
Forms![Invoice Scanner]!InvSub.Form!CurPayIn = "GBP"
End If
If Me.EURO.Value = True Then
Me.GBP.Enabled = False
ElseIf GBP.Value = True Then
Me.EURO.Enabled = False
Else
Me.EURO.Enabled = True
Me.GBP.Enabled = True
End If
End Sub
Private Sub GBP_Click()
If Me.GBP.Value = True Then
Me.EURO.Value = False
Else
Me.EURO.Value = False
End If
End Sub
|
|

July 13th, 2005, 10:26 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi again...
what kind of error are you getting???
that will be more usefull than the code..
anyway remember that value property works with numbers, not boolean, you should be passing 0 to clear it (if my memory doesnt fail)...
HTH
Gonzalo
|
|

July 13th, 2005, 10:31 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I don't get en error when I run the code.
|
|

July 13th, 2005, 10:36 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
ok.. so try to explain your problem better..
you want to disable the check when the other is selected.. by disable you mean unchecked or grayed???
why the last code didnt work???
HTH
Gonzalo
|
|
 |