DCount Syntax

D

DS

I have a problem with the following DCount statement.
I keep getting a Syntax error, any help appreciated.
Thanks
DS


Me.TextMenus = DCount("[MenuID]", "MenuDetails", " & _
"TerminalID = " & Forms!Form4!TxtStation & " " & _
"AND MenuID = " & Forms!Form4!TxtMenu & " " & _
"AND StartDay = 4 " & _
"AND StartTime = " & <Time() & " " & _
"AND EndTime = " & >Time() & " " & _
"AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")
 
T

Tom Lake

DS said:
I have a problem with the following DCount statement.
I keep getting a Syntax error, any help appreciated.
Thanks
DS

I'm not sure what you're using < and > for but try the below

Tom Lake


Me.TextMenus = DCount("[MenuID]", "MenuDetails", " & _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime <= " & Time() & _
" AND EndTime >= " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")
 
D

DS

Tom said:
I have a problem with the following DCount statement.
I keep getting a Syntax error, any help appreciated.
Thanks
DS


I'm not sure what you're using < and > for but try the below

Tom Lake


Me.TextMenus = DCount("[MenuID]", "MenuDetails", " & _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime <= " & Time() & _
" AND EndTime >= " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")
Sorry, doesn't work, Its all in red. I'm using the <> to say that the
StartTime should be less than the current time and the EndTime should be
greater than the current time.
Thanks
DS
 
T

Tom Lake

I missed the first problem at the end of the first line:

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime < " & Time() & _
" AND EndTime > " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")
 
D

DS

Tom said:
I missed the first problem at the end of the first line:

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime < " & Time() & _
" AND EndTime > " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")


Sorry, doesn't work, Its all in red. I'm using the <> to say that the
StartTime should be less than the current time and the EndTime should be
greater than the current time.
Thanks
DS
Tom,
I'm getting Missing Operator 3075...

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"MenuDetails.TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuDetails.MenuID = " & Forms!Form4!TxtMenu & _
" AND MenuDetails.StartDay = 4 " & _
" AND MenuDetails.StartTime < " & Time() & _
" AND MenuDetails.EndTime > " & Time() & _
" AND MenuDetails.Active = -1 " & _
" AND MenuDetails.AfterMidnite = " & 0 & "")

Thanks
DS
 
D

DS

DS said:
Tom said:
I missed the first problem at the end of the first line:

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime < " & Time() & _
" AND EndTime > " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")


Sorry, doesn't work, Its all in red. I'm using the <> to say that
the StartTime should be less than the current time and the EndTime
should be greater than the current time.
Thanks
DS
Tom,
I'm getting Missing Operator 3075...

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"MenuDetails.TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuDetails.MenuID = " & Forms!Form4!TxtMenu & _
" AND MenuDetails.StartDay = 4 " & _
" AND MenuDetails.StartTime < " & Time() & _
" AND MenuDetails.EndTime > " & Time() & _
" AND MenuDetails.Active = -1 " & _
" AND MenuDetails.AfterMidnite = " & 0 & "")

Thanks
DS
The Problem seems to be with the StartTime and EndTime fields. When I
remove them it works....
Thanks
DS
 
D

DS

DS said:
DS said:
Tom said:
I missed the first problem at the end of the first line:

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuID = " & Forms!Form4!TxtMenu & _
" AND StartDay = 4 " & _
"AND StartTime < " & Time() & _
" AND EndTime > " & Time() & _
" AND Active = -1 " & _
"AND AfterMidnite = " & 0 & "")



Sorry, doesn't work, Its all in red. I'm using the <> to say that
the StartTime should be less than the current time and the EndTime
should be greater than the current time.
Thanks
DS
Tom,
I'm getting Missing Operator 3075...

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"MenuDetails.TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuDetails.MenuID = " & Forms!Form4!TxtMenu & _
" AND MenuDetails.StartDay = 4 " & _
" AND MenuDetails.StartTime < " & Time() & _
" AND MenuDetails.EndTime > " & Time() & _
" AND MenuDetails.Active = -1 " & _
" AND MenuDetails.AfterMidnite = " & 0 & "")

Thanks
DS
The Problem seems to be with the StartTime and EndTime fields. When I
remove them it works....
Thanks
DS
This Works

Me.TextMenus = DCount("[MenuID]", "MenuDetails", _
"MenuDetails.TerminalID = " & Forms!Form4!TxtStation & _
" AND MenuDetails.MenuID = " & Forms!Form4!TxtMenu & _
" AND MenuDetails.StartDay = 4 " & _
" AND MenuDetails.StartTime <= #" & Time() & "#" & _
" AND MenuDetails.EndTime >= #" & Time() & "#" & _
" AND MenuDetails.Active = -1 " & _
" AND MenuDetails.AfterMidnite = " & 0 & "")

Thank You for your help!
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

DLookup Seperate Lines 2
Combining 2 DCounts 2
A Lot of Code 10
Table Quandry 11
SQL to DCount 4
DateDiff Problem 9
Filtered Records 1
Combining 2 Queries 2

Top