Results 1 to 11 of 11
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form question (VB 6)

    I have a form with 2 check boxes on it. I want the Ext Price and the Price field to reflect either a discount 1 or a discount 2 if either box is checked. I have the form working correctly except am having major difficulty getting the discount 2 check box to work. I have tried many methods, but to no avail, so have backed completely up, and have only inserted the Discount2 prices into the txt file, and created a Discount2 chkbox on the form. Could someone please help me get this Discount2 checkbox to show the value when checked of the second discount from the txt file?

    Ever and always so greatful for help

    Nannette
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form question (VB 6)

    In the cmdAdd_Click procedure, you test whether chkDiscount1 has been ticked, and adjust the price accordingly, but you don't test whether chkDiscount2 has been ticked.
    The form as it is allows you to tick both chkDiscount1 and chkDiscount2. Is that as intended? If so, you will have to take that into account too, but I don't think your text file does so.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form question (VB 6)

    Hans,

    Your right. Have added that extra part, but still doesn't work...will continue to work on it...

    Thank you,
    Nannette
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form question (VB 6)

    What have you added and where?

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form question (VB 6)

    Attaching retyped code in txt file

    thanks for helping Hans
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form question (VB 6)

    You still do not use the second discounted price anywhere in your code: you don't read it from the text file, you don't plug it into the calculations. Try the attached version. I have inserted comments to indicate what has changed.
    The problem that you can tick both check boxes remains - the text file and code contains no clue as to what should happen then; the attached code ignores the second check box if the first one is ticked.

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form question (VB 6)

    Hans,
    I'm sorry, I have so many versions of this project I had to have sent you the wrong one...I truly did add a clip for Discount2 where you did, and changed the 2 to a 3 and wrote the msng line at the bottom...it's been totally whacko here...thanks for looking at it...I had not wrote the inclusion like you did, and your inclusion says more in less....but my program still keeps stopping on the word VALUE in this line:

    Private Sub cmdAdd_Click()
    Dim psngExtPrice As Single
    If cboProducts.ListIndex > -1 Then
    If IsNumeric(txtQty.Text) Then
    lstQuotedProduct.AddItem cboProducts.Text
    'It keeps stopping on the following line...on the
    'word Value.............
    If chkDiscount.Value = vbChecked Then
    psngExtPrice = (txtQty.Text * _
    msngPrices(cboProducts.ListIndex, 1))
    lstQuotedPrice.AddItem _
    Format(msngPrices( _
    cboProducts.ListIndex, 1), "Fixed")

    Nannette
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form question (VB 6)

    I'm sorry, no idea, it works OK on my system. You coud check for missing references (Project | References...) but if you had missing references, you would probably have more more problems...

  9. #9
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form question (VB 6)

    I got it.
    I was not assigning a value to the chkbox's...they are part of an "array"...I assigned values (0) to the first chkDiscount and (1) to the chkDiscount2:

    If chkDiscount(0).Value = vbChecked Then
    psngExtPrice = (txtQty.Text * _
    msngPrices(cboProducts.ListIndex, 1))
    lstQuotedPrice.AddItem _
    Format(msngPrices( _
    cboProducts.ListIndex, 1), "Fixed")

    ElseIf chkDiscount2(1).Value = vbChecked Then
    psngExtPrice = (txtQty.Text * _
    msngPrices(cboProducts.ListIndex, 2))
    lstQuotedPrice.AddItem _
    Format(msngPrices( _
    cboProducts.ListIndex, 2), "Fixed")

    It works like a charm...
    Anyhow...hope this helps anyone who may have overlooked the obvious like me...
    Thank you for your help Hans...I do appreciate all your effort and the code fixes you so kindly pointed out and fixed for me.

    Nannette <img src=/S/salute.gif border=0 alt=salute width=15 height=20>
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form question (VB 6)

    >> they are part of an "array"...

    There was no way for me to have known that, since the check boxes are NOT part of an array in the form as you attached it.

  11. #11
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form question (VB 6)

    Hans,

    Yes that is very true...remember I stated I didn't think I sent you the correct version. I am sorry. I have been working on several, and always keep backups here and there in case I have to return and start from scratch...I had to have sent you one without arrays.

    So sorry....truly
    Nannette
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •