DCount Help

martell

Registered User.
Local time
Today, 08:25
Joined
Dec 27, 2007
Messages
10
dear all,

i have the problem when using dcount in my query,anyone can help me?this is the situation.

Table 1:

Num

20080207
20080215
20080218

Table 2:

Begin End

20080206 20080208
20080200 200802116


i want to make the query,and i want to add field "sumactive" using the dcount function refer to Table 1,anyone can help me?i want to count how many record "num" in table 1,between field "begin" and field "end" in table 2

Begin End sumactive

20080206 20080208 1
20080200 20080216 2

thanks

regards

martell
 
Assuming that Begin, End and Num are all text fields, try the following SQL:

SELECT T2.Begin, T2.End,
DCount("[Num]","[Table 1]","[Num] Between '" & T2.Begin & "' And '" & T2.End & "'") AS SumActive
FROM [Table 2] AS T2
 

Users who are viewing this thread

Back
Top Bottom