Syntax error (comma) in query expression

01-12-2004, 07:43 PM
I have a strange one here.

Data1.RecordSource = "Select * FROM " & tablename & " where onenumber = " & fromnumber & " AND othernumber = " & tonumber

Works fine if the windows regional settings uses
the point for the Decimal symbol
the comma for the digit grouping symbol.

When they are set in reverse the runtime error 3075 comes up and the numeric number contained in the fromnumber and tonumber seems to raise the error. How do I get around this, I cannot alter the regional settings.

Thanks for the advice.

01-16-2004, 01:57 PM
I have solved the problem, for all those interested.

When the windows regional settings use the comma "," as a decimal indicator the database handlers correctly handle the transition for stored records without problems. However as soon as you need to do a query using the select statement you need to replace the "," comma with a "." point.


fromcheck = (Replace(Str(text1.Text), ",", "."))
tocheck = (Replace(str(text2.Text), ",", "."))
Data2.RecordSource = "Select * FROM " & tablename & " where frompoint = " & fromcheck & " AND topoint = " & tocheck

Will be the workaround for the syntax error.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum