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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using commas in SQL statements

Status
Not open for further replies.

ndalli

Programmer
Nov 6, 1999
76
MT

I am inserting into an access table a number of numeric fields. I am doing this by storing the insert statement into a variable and then executing the contents of this variable.

The system settings on the user's PC is set to a comma and thus 3.4 (3 point 4) is threated as 3, 4 (3 comma 4). On executing the SQL insert statement, I am getting an error that the number of fields do not match the number of target fields. The reason of this is that 3, 4 is being threated as two different fields.

Is there a way how to make VB work having the system settings set to both a point or comma?


Thanks in advance
 
You need to enclose the numberic value in single quotes. Then it will work.

Or, use the Str() function:

Str("1,2") = 1.2. This uses the set system decimal separator and coverts to US format.
Which means Str("1.2") will return 12 if the Decimal separator is a comma (usually the thousands separator is the a comma).
And Str("1.2") will return 1.2 if the decimal seperator is a Dot. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top