Rounding

  • Thread starter Thread starter CornDog
  • Start date Start date
C

CornDog

I have a table with numbers like so
$10,000.27
$15,000.00

These values are used to populate a combobox
The combobox shows them as
$10,000.27
$15,000.00

Based on a users selection the value is placed into a SQL
filter criteria.

Problem is $10,000.27 works fine, but $15,000.00 drops the
decimal places. How do I maintain the $15,000.00 if the
code looks like so

strSQL = strSQL & Forms![sfrmFilter].FilterHidden1 & " = "
& Forms![sfrmFilter].Filter2 & " And "
 
Forgot to mention that the SQL statement doesnt contain
the $ or comma for any value. I would like it to be shown
too.
 
CornDog said:
Forgot to mention that the SQL statement doesnt contain
the $ or comma for any value. I would like it to be shown
too.

Why? These should all be irrelevant to the criteria returning the proper records.
What is actually stored in your table is 15000. All the rest is just display
formatting. Unless this field you are filtering on is a text field?
 
I don't know if this is exactly what you were hoping for, but below I have
pasted some code I use in a msgbox to help maintain the zeros on the end of
the dollar figure. To get the dollar symbol ($) itself I just add it into
the statement as part of the string.

'****start***
MsgBox("The outstanding balance is $" & IIf(IsNull(varTotalPayments),
Format(varInvoiceTotal, "##,###,###.00"), Format(varAmountOwed,
"##,###,###.00")) & _
"." & Chr(13) & "You are about to enter a payment of $" &
Format(.Value, "##,###,###.00") & ". Do you wish to continue.",
vbExclamation + vbYesNoCancel + vbDefaultButton1, "Payment pending")
'***end***


Jamie :o)
I have a table with numbers like so
$10,000.27
$15,000.00

These values are used to populate a combobox
The combobox shows them as
$10,000.27
$15,000.00

Based on a users selection the value is placed into a SQL
filter criteria.

Problem is $10,000.27 works fine, but $15,000.00 drops the
decimal places. How do I maintain the $15,000.00 if the
code looks like so

strSQL = strSQL & Forms![sfrmFilter].FilterHidden1 & " = "
& Forms![sfrmFilter].Filter2 & " And "
 
Hi.

I also forgot to mention that the method I posted under this thread (see Re:
Rounding) will format any numbers to the right of the decimal point, it
won't just force them to be zero!


Jamie :o)
Forgot to mention that the SQL statement doesnt contain
the $ or comma for any value. I would like it to be shown
too.
 
Think maybe i didnt describe this right:

I have a variable of String type it could contain

A Date: "08/08/01" which I can detect with IsDate
(strVariable)

A Currency: "1234" <- what I get | what I want ->"1234.00"
Im trying to dectect it by seeing if it contains $, comma
or decimal. How do I assure that when the varString gets
its value from the combo box (which displays the number as
$1234.00) it stores "$1234.00" and not 1234

A Number: "28" Dont know what to do

A String: "Mr. Thomas" which I can detect by process of
elimination.
-----Original Message-----
I don't know if this is exactly what you were hoping for, but below I have
pasted some code I use in a msgbox to help maintain the zeros on the end of
the dollar figure. To get the dollar symbol ($) itself I just add it into
the statement as part of the string.

'****start***
MsgBox("The outstanding balance is $" & IIf(IsNull (varTotalPayments),
Format(varInvoiceTotal, "##,###,###.00"), Format (varAmountOwed,
"##,###,###.00")) & _
"." & Chr(13) & "You are about to enter a payment of $" &
Format(.Value, "##,###,###.00") & ". Do you wish to continue.",
vbExclamation + vbYesNoCancel +
vbDefaultButton1, "Payment pending")
'***end***


Jamie :o)
I have a table with numbers like so
$10,000.27
$15,000.00

These values are used to populate a combobox
The combobox shows them as
$10,000.27
$15,000.00

Based on a users selection the value is placed into a SQL
filter criteria.

Problem is $10,000.27 works fine, but $15,000.00 drops the
decimal places. How do I maintain the $15,000.00 if the
code looks like so

strSQL = strSQL & Forms![sfrmFilter].FilterHidden1 & " = "
& Forms![sfrmFilter].Filter2 & " And "


.
 
Back
Top