Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL UPDATE currency field problem

Status
Not open for further replies.

JakeNL

Technical User
Jan 30, 2002
5
NL
I try to update a currency field in my ms acess db from a program in VB6 (sp5). Herefor I execute a SQL string-command over the active connection.
The variable total is also declared a currency type variable.

The error message tells me that there is an error in the command and that it is about the comma in the expression. This must be the comma in the variable as the decimal separator. SQL needs that to be a dot instead of a comma. I tried multiple options on the variable but it keeps ending up with the comma.

The command string :

sSQLfin = "UPDATE tbl_members SET Financialx = Financialx + " & CDbl(total)


All advice and help is welcomed !!

Thanks in advance, Jack
 
Have tried this ?
sSQLfin = "UPDATE tbl_members SET Financialx = Financialx + " & Format(total, "0.00")


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Nope,

No result it comes up with a syntaxis error.
 
Don't know how we use personalized format in VB, however I guess it's how you'll solve your issue.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Just another guess:
& Replace(CDbl(total), ",", ".")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV,

I only had to adjust one thing like :

Replace(CStr(totaal), ",", ".") and now it is running.

case closed and Thanks for your help and time !!!

Jack


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top