Syntax error (comma) in query expression

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

The
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
and
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.

gprinsloo
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.

Typically

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