SQL to DCount

D

DS

I have this SQL statement that I need to convert to a DCount...
This is what I have So Far...

Me.TxtMenuCount = DCount("MenuID","MenuDetails",....?)

My SQL statement...

SELECT MenuDetails.MenuID, Menus.MenuName, MenuDetails.StartDay,
MenuDetails.StartTime, MenuDetails.EndDay, MenuDetails.EndTime,
Hour([StartTime]) AS Start,
IIf([EndDay]>[StartDay],Hour([EndTime])+12,Hour([EndTime])) AS [End]
FROM MenuDetails INNER JOIN Menus ON MenuDetails.MenuID = Menus.MenuID
WHERE (((MenuDetails.StartDay)=Weekday(Now())) AND
((Hour([StartTime]))<=Hour(Time())));

Any help apprecited,
Thanks
DS
 
K

Ken Snell \(MVP\)

No can do what you want. DCount works with either a single table or a single
query. In your case, the query that you want to "convert" to DCount uses
multiple tables, so you cannot convert directly. You'd need to store a query
that gives the results of your posted query, and then use DCount on that
query.
 
D

DS

Ken said:
No can do what you want. DCount works with either a single table or a single
query. In your case, the query that you want to "convert" to DCount uses
multiple tables, so you cannot convert directly. You'd need to store a query
that gives the results of your posted query, and then use DCount on that
query.
Thanks Ken, Is there any chance of using that SQL code with maybe a
Count(*) line added it to pass the count to a textbox?
Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Filtered Records 1
Combining 2 DCounts 2
Combining 2 Queries 2
DCount Syntax 6
ControlSource Not Working 3
After Midnite Problem 4
SQL SubQuery 7
DCount with multiple conditions 2

Top