Wrox Programmer Forums
|
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
 
Old July 12th, 2005, 02:00 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Disable Check Boxes

Hello,

I need help with disabling one check box when another checkbox is selected on a form I built in Access?
 
Old July 12th, 2005, 03:30 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

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.
 
Old July 13th, 2005, 08:38 AM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help, but my customer requested checkboxes.

 
Old July 13th, 2005, 08:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
 
Old July 13th, 2005, 09:29 AM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old July 13th, 2005, 09:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi..

you dont have to use the disable property, use the value property and set it to false.



HTH

Gonzalo
 
Old July 13th, 2005, 10:22 AM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old July 13th, 2005, 10:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
 
Old July 13th, 2005, 10:31 AM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't get en error when I run the code.

 
Old July 13th, 2005, 10:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop over check boxes sams ASP.NET 1.0 and 1.1 Professional 5 July 17th, 2007 06:26 AM
Help with VBA Disable/Enable text boxes yayomayn Access VBA 4 February 10th, 2007 08:43 PM
Check Boxes Allan320 Access VBA 3 June 2nd, 2006 05:45 AM
Using check boxes to filter dstein4d Access VBA 13 January 25th, 2006 07:50 PM
Getting value of Dynamic Check boxes kathryne Classic ASP Databases 3 March 19th, 2004 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.