Thanks for taking the time out to post the code and an explanation Surfdemon, it worked!! greatly appreciated
Claire
Printable View
Thanks for taking the time out to post the code and an explanation Surfdemon, it worked!! greatly appreciated
Claire
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
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).:p
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.:D
SD
Come on people !
http://forums.vb-world.net/showthrea...threadid=66144
:)
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
Code:txtAmount.Text = FormatCurrency(Text1.Text, 2)
Thanks but where exactly do I put that. Your dealing with a real beginner here!!
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.
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
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.
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
Now get back to drinking Guinness before they go on strike!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
If it doesn't work, or do what you want, then let me know.
Cheers,
SD
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
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
Anytime Claire!:)
SD