Results 1 to 14 of 14

Thread: Thanks SurfDemon

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    29

    Thumbs up

    Thanks for taking the time out to post the code and an explanation Surfdemon, it worked!! greatly appreciated
    Claire
    Claire

  2. #2
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    It's my distinct pleasure.

    My only question is, why aren't you in the pub at this late hour. (My excuse is that I'm 7 time zones away)

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  3. #3
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Oh! Bye the way, you don't have to delete your threads after you've finished with them, other people might find them useful, but are too shy to ask

    Of course, you can delete them if you want (it's entirely up to you).

    Have fun, (and get out of the computer lab and into the pub! It's unhealthy for a student to be sober after 9pm). Tell 'em the surf demon sent you.

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    29
    I still can't get the 2 decimal place thing to work.
    I went to the pub after last night and i'm just after getting back now!!
    If i can get the 2 decimal bit workin' i'll be done. Can you help?
    Im trying to divide a decimal number in one text box with a whole number in the second box.
    when i tab out of the second box it displays the answer in a third box.(amount)

    The answer is coming up like this ##.########### and saves it to the database like that. Im dealing with money in an account so I want the amount to save to the database like this ##.##
    Please help Surfdemon - you sound like a genius!

    Thanks,
    Claire
    Claire

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Code:
        txtAmount.Text = FormatCurrency(Text1.Text, 2)
    Last edited by Lethal; Apr 5th, 2001 at 12:29 PM.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    29

    Where?

    Thanks but where exactly do I put that. Your dealing with a real beginner here!!
    Claire

  8. #8
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Since I do not fully understand your situation, you can format your data directly with the textbox. There is an option called dataformat property for the textbox control, you could just set that to Currency.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    29
    I tried that but it didn't work,

    I'll mess around with it for a bit and come back if i still can't get it to work,
    Thanks for your help,
    Claire
    Claire

  10. #10
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    What didn't work. The dataformat?? I'm assuming that you are using an access database with the data field set to Currency. Using the dataformat prop, you can specify how your data will appear to the user. Should work, I just tested it.

  11. #11
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Oh you smooth talking devil!

    How can I possibly not answer a compliment like that, even if it is untrue.

    Try this.

    Put three text boxes on a form

    txtFirstNumber, txtSecondNumber and txtAmount

    Now put this code in the validate event for txtSecondNumber

    Code:
    Private Sub txtSecondNumber_Validate(Cancel As Boolean)
        Dim curAmount As Currency
        
        curAmount = CCur(Val(txtFirstNumber.Text) / Val(txtSecondNumber.Text))
        txtAmount.Text = Format$(curAmount, "$0.00")
    End Sub
    Now get back to drinking Guinness before they go on strike!

    If it doesn't work, or do what you want, then let me know.

    Cheers,

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  12. #12
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Of course you can change the $ in the format bit that says "$0.00" to a pound sign. This keyboard doesn't have one.

    Cheers,

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    29
    Sorry 'bout the delay in replying - must have been all the dhrink over the weekend dulling my interest in sittin' infront of the computer again.
    Anyway, im back now and I got it to work at last.
    i was just puttin the format code in the wrong place. Woops!
    Thanks Lethal and Surfdemon!!
    Im sure ill have a few more questions for you soon!
    Claire
    Claire

  14. #14
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Anytime Claire!

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

Posting Permissions

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



Click Here to Expand Forum to Full Width