Using SQL with decimals-vba

mfaqueiroz

Registered User.
Local time
Today, 15:30
Joined
Sep 30, 2015
Messages
125
Hei!

I have one simple doubt about decimals numbers, how should I declare them to work in a SQL sentence?
as Single?


I have one sentence that count the number of entries with code=1 and with the TimeMS(time converted in miliseconds) between MEtimeMS and MeTimeMS2.
The TimeMs is in this format: xxxxxxxxx,xxxx
in this case:
TimeMs= 363270805,1955

Count1 = Nz(DCount("*", "Tab", " ((Tab.[TimeMS])> " & MeTimeMS & ") and Tab.[TimeMS] < " & MeTimeMS2 & " And Tab.
Code:
 = '1' "), 0)

appears always this error:
Syntax error(comma) in query expression.


Could anyone help me with this issue?
thank you!:)
 
Declare the value as Double as it looks like it could be quite large.

Why is there a comma there are they nanoseconds? You may need to convert the value to remove the comma.
 
Try by replacing the comma it with a dot, ".".
 
Thanks!
I've tried with double but the error remains.
How can I replace the "," for "." ? with vba code
:)
thanks!
 
I don't know if it is a typo, but you're missing a . between Me and TimeMS2.
You've:
Count1 = Nz(DCount("*", "Tab", " ((Tab.[TimeMS])> " & MeTimeMS & ") and Tab.[TimeMS] < " & MeTimeMS2 & " And Tab.
Code:
 =  '1' "), 0)[/QUOTE]  It should be:
[QUOTE]Count1 = Nz(DCount("*", "Tab", " ((Tab.[TimeMS])> " & Me[SIZE=4][B][COLOR=Red].[/COLOR][/B][/SIZE]TimeMS  & ") and Tab.[TimeMS] < " & Me[SIZE=4][B][COLOR=Red].[/COLOR][/B][/SIZE]TimeMS2 & " And Tab.[Code] =  '1' "), 0)[/QUOTE]
If you can't get it post your database with some sample data, (zip it) + write where you've the problem.
 
Hei!
I've tried to force the "." but always appears the comma ","....
do you have ideia how can i solve that?
:)
 
Post your database with some sample data, (zip it) + name of the query in which you've the problem.
 

Users who are viewing this thread

Back
Top Bottom