dsum overflow

collinm

Registered User.
Local time
Today, 14:33
Joined
Apr 20, 2006
Messages
14
hi

i have a access database (250mb)

when access run this line,
i get:

run time error : 6
Overflow

Code:
totaldga = DSum("nombre_dga", "tbExcel", " jour >= " + "#" & Me.txtDateDebut & "#" + " and jour <= " + "#" & Me.txtDateFin & "#" + " and heure_debut >= " + "#" & Me.txtHeureDebut & "#" + " and heure_fin <= " + "#" & Me.txtHeureFin & "#" + " and transit in (" & Left(strIN, Len(strIN) - 1) & ")")

if i do:

Code:
totaldga = DSum("nombre_dga", "tbExcel", " jour >= " + "#" & Me.txtDateDebut & "#" + " and heure_debut >= " + "#" & Me.txtHeureDebut & "#" + " and heure_fin <= " + "#" & Me.txtHeureFin & "#" + " and transit in (" & Left(strIN, Len(strIN) - 1) & ")")

that work fine........ access don't seem to like: jour >=....... and jour <= ........

any idea?

thanks
 
Last edited:
Try changing the concantenation character to "&" rather than the mathematical operator "+". They sometimes work the same but not always.
 
RuralGuy said:
Try changing the concantenation character to "&" rather than the mathematical operator "+". They sometimes work the same but not always.

ok i changed + for & and get the same problem....... tried to use between..... get the same result......


surely a access bug....... if i use directely sql command, that work fine..... but i don't know how to set the sql query result to a label.....
 
What object type is totaldga? Have you considered using parens to group your tests?
 
RuralGuy said:
What object type is totaldga? Have you considered using parens to group your tests?

is integer......

another question

Code:
dim db as dao.database
dim rs as dao.recordset
set db = currentdb
set rs = db.openrecorset("select sum(nombre_dga) as DGA...")
msgbox rs.fields(nombre_dga) 'problem here

why i get: item not found in this collection?
 
Change your variable to a Long or even Single or Double if you expect a decimal. Integers can only hold up to +/- 32,000~. As to the other issue, how about rs.fields(DGA...)? You are not selecting the [nombre_dga] field but a SUM of it renamed as DGA...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom