Re: how to change decimal symbol in VB / Access?
- From: MarisB <MarisB@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 1 Jun 2005 01:03:15 -0700
gaI tried the CODE you sugested but result wasn't such as i expected...
insted of "5.882" i recivded "0.006" :(
MAYBE THERE'S OTHER WAYS TO DO IT, PLS SOMEONE HELP!!!
PS> that's right TIM, some of the code wasn't real, becouse the real code is
much more longer, but i have headache only about this part, so i have to
corect it a bit
"Tim Ferguson" wrote:
> =?Utf-8?B?TWFyaXNC?= <MarisB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> news:3F3898B2-119B-44AB-B913-207425046EA3@xxxxxxxxxxxxx:
>
> > Dim tBillNo, tVIN as string
>
> Please note: tBillNo is dimmed as a Variant not as a string
>
> > Dim t_totSUM as double
>
> string and double has a lower case letters, so I assume that this is not
> real code
>
> > tBillNo="CF4354545645"
>
> > tVIN="H200MMM"
>
> > t_totSUM=100/17
>
> > inSQL = "INSERT INTO table 1 (BillNo, VIN, totSUM)" & _
> > "SELECT '" & tBillNo & "', '" & tVIN & "', " & t_totSUM
>
> there is no space between the parts, therefore inSQL looks like
> "...totSum)SELECT..."
>
> t_totSUM is dimmed as a double, so you are asking for it to be coerced
> into a string without specifying a format. This is not a reasonable thing
> to do: databases and their libraries (i.e. Jet, SQL S, ADO, DAO etc) have
> to work independently of regional settings, otherwise it would be
> impossible to program them for international use. Therefore, you have to
> control all conversions of numbers and dates explicitly. I have not
> looked specifically, but I'd bet good money that SQL Server and ADO both
> expect american-type numbers with a dot for a decimal separator.
>
> You rally need to do something like
>
> Dim t_totSUM As String
>
> t_totSUM = Format(100/17, "0\.000")
>
> .... the backslash forces the use of a dot rather than whatever OLEAUT32
> thinks would look nice.
>
> Hope that helps
>
>
> Tim F
>
>
>
>
> > Set inRS = CreateObject("ADODB.Recordset")
> > inRS.Open inSQL, inCON, adOpenStatic
> >
>
>
.
- Follow-Ups:
- Re: how to change decimal symbol in VB / Access?
- From: Tim Ferguson
- Re: how to change decimal symbol in VB / Access?
- Prev by Date: Re: Check that path exists.
- Next by Date: Re: Code to Remove Specific Character at End of String
- Previous by thread: Re: Troubles with variables and objects
- Next by thread: Re: how to change decimal symbol in VB / Access?
- Index(es):
Relevant Pages
|