PDA

Click to See Complete Forum and Search --> : Easy one


turfbult
Aug 24th, 2000, 05:54 AM
txtItemPrice must be a numeric on my form

How will I add this to my database or do calculations on it, ensuring that it is saved as numeric and not as text....

Insert into database....

insert into client values txtItemPrice

or

insert into client values " & txtItemPrice & "

or

???

Calculations....

intTotal = txtItemPrice + txtItemVat

or

intTotal = "txtItemPrice" + "txtItemVat"

or

????

Stevie
Aug 24th, 2000, 06:06 AM
When inserting into your database, if you want it to go in as numeric then use INSERT INTO Client VALUES txtItemPrice.

When calculating (I'm presuming you're using integers due to what you've call your variable) then you would use the following ...


intTotal = CInt(txtItemPrice.text) + CInt(txtItemVat.text)

JHausmann
Aug 24th, 2000, 11:30 AM
Usually taxes and prices have dollars and cents (or pick you favorite currency and fractinal part, thereof). For that reason, I'd use CCUR instead of CINT

Stevie
Aug 24th, 2000, 11:50 AM
I would usually use CCur instead of CCint as well. I only used CInt as turfbults naming of variables indicates that he is using integers. ;)