dcount vs SQL(VBA) for a calculated control

crispbreeze19

Registered User.
Local time
Yesterday, 22:15
Joined
Feb 7, 2005
Messages
10
Here is the SQL that A2K gives me for the query that has the actions I want it to perform. But I can't get it to give me a count of the number of records returned. I would love to use DCOUNT but I am having a tough time working it out. Also in the final soultion, the numbers 2 and 23 are fields that I have 2 = weekday and 23 = [weekday] + [tt] which are in a different table. If someone could help me out with the DCOUNT formula, I would be forever appreciative.

SELECT DISTINCTROW noweekend.noweekday, noweekend.dayid
FROM noweekend
GROUP BY noweekend.noweekday, noweekend.dayid
HAVING (((noweekend.noweekday)=1) AND ((noweekend.dayid)>=2 And (noweekend.dayid)<23)) OR (((noweekend.noweekday)=7) AND ((noweekend.dayid)>=2 And (noweekend.dayid)<23));
 
Still getting errors

I tweeked your SQL statement and formed into this. can tell me what I am doing wrong

SELECT Scan_Date_Table.DS, Scan_Date_Table.DSS, DCount("dayid","noweekend","(((noweekend.noweekday)=1) AND ((noweekend.dayid)>=Weekday(Scan_Date_Table.DSS) And (noweekend.dayid)<((Scan_Date_Table.DS)-(Scan_Date_Table.DSS)))) OR (((noweekend.noweekday)=7) AND ((noweekend.dayid)>=Weekday(Scan_Date_Table.DSS) And (noweekend.dayid)<((Scan_Date_Table.DS)-(Scan_Date_Table.DSS))))") AS TT
FROM Scan_Date_Table, noweekend
GROUP BY Scan_Date_Table.DS, Scan_Date_Table.DSS, DCount("dayid","noweekend","(((noweekend.noweekday)=1) AND ((noweekend.dayid)>=Weekday(Scan_Date_Table.DSS) And (noweekend.dayid)<((Scan_Date_Table.DS)-(Scan_Date_Table.DSS)))) OR (((noweekend.noweekday)=7) AND ((noweekend.dayid)>=Weekday(Scan_Date_Table.DSS) And (noweekend.dayid)<((Scan_Date_Table.DS)-(Scan_Date_Table.DSS))))");
 

Users who are viewing this thread

Back
Top Bottom