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

Ok I'm sorry, what I mean is if the customer selects EURO then I don't want the customer to be able to select GBP also. SO if one is selected I want the other one to be grayed. If neither is selected I want the invoice form to show U.S. dollars by default.


I hope this helps

 
Old July 13th, 2005, 12:11 PM
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

so your code fails why??

it's look ok for me.. what part is not doing the job?? when you click one check, the other grayed???

HTH

Gonzalo
 
Old July 13th, 2005, 12:46 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can still click both checkboxes at the same time

 
Old July 13th, 2005, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The Value property of the checkbox control is not a boolean, but an int: vbChecked or vbUnchecked. A boolan False is 0, True is -1. Unchecked is 0, checked is 1.

Private Sub GBP_Click()
Euro.Value = iif(GBP.Value = vbChecked, vbUnchecked, vbChecked)
End Sub


Marco
 
Old July 13th, 2005, 01:07 PM
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.. let's see..

if you trace the following code:
Code:
 
Private Sub GBP_Click()
If Me.GBP.Value = True Then
    Me.EURO.enabled= False
 Else
    Me.EURO.enabled= False
End If
End Sub
did this work??
it should be disabling one of them.. also you will have to uncheck it if when you disable it with

(thanks marco!) euro.value = vbunchecked

can you trace the code to see if no other part enable it again???

HTH

Gonzalo
 
Old July 13th, 2005, 01:11 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't get what your saying

 
Old July 13th, 2005, 02:28 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok guys I tried all your ideals, I don't know what I'm doing wrong

 
Old July 13th, 2005, 02:46 PM
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

try this...

on a new form paste to check boxes and this code

Code:
Private Sub Check1_Click()
    If Check1.Value = vbChecked Then
        Check2.Enabled = False
    Else
        Check2.Enabled = True
    End If
End Sub

Private Sub Check2_Click()
    If Check2.Value = vbChecked Then
        Check1.Enabled = False
    Else
        Check1.Enabled = True
    End If
End Sub
and tell me if that is what you want.. if that is not then you are not explaining ok what you want...

HTH

Gonzalo
 
Old July 13th, 2005, 03:48 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok I'm so sorry after reviewing what I trying to accomplish I realized that I was writing the code in the wrong object. Thank you so much for your help.

 
Old July 13th, 2005, 03:53 PM
Authorized User
 
Join Date: Jul 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now I wrote the code to display U.S. Dollars as default if nothing is selected, however I need to write a line of code to clear the field so if I check EURO or GBP is will display that and not U.S. dollars. Here's the code I wrote. I also put the code for disabling the checkboxes just in case you wanted to see it.

Thank you

'If EURO is chcked display EURO on invoice form
If Forms![Invoice Scanner].EURO = True Then
   Forms![Invoice Scanner]!InvSub.Form!CurPayIn = "EURO"
Else
    Forms![Invoice Scanner]!InvSub.Form!CurPayIn = "U.S. Dollars"
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"
Else
    Forms![Invoice Scanner]!InvSub.Form!CurPayIn = "U.S. Dollars"

End If



'Disable Checkbox.
Private Sub GBP_Click()
If Me.GBP.Value = True Then
    Me.EURO.Enabled = False
 Me.EURO.Value = False
   Else
    Me.EURO.Enabled = True

End If
End Sub


'Disabling Checkboxes
Private Sub EURO_Click()

If Me.EURO.Value = True Then
    Me.GBP.Value = False
 Me.GBP.Enabled = False
Else
    Me.GBP.Enabled = True
End If






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.