DCount problem

Z

zSplash

I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does anyone
see something goofy in my code?

TIA
 
D

Douglas J. Steele

Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)
 
Z

zSplash

Thanks, Doug. Now, instead of getting 0 as the count, I'm getting #Error.
What does that type of error indicate? (Once again, I know there's
something to count.)

Douglas J. Steele said:
Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


zSplash said:
I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does
anyone see something goofy in my code?

TIA
 
D

Douglas J. Steele

Just noticed that the parentheses are off as well.

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06# And [q1Main.CaseType]='CUS'")

Sorry about that.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


zSplash said:
Thanks, Doug. Now, instead of getting 0 as the count, I'm getting #Error.
What does that type of error indicate? (Once again, I know there's
something to count.)

Douglas J. Steele said:
Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


zSplash said:
I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does
anyone see something goofy in my code?

TIA
 
Z

zSplash

Thanks for that. (I had just added a paren at the end of the statement.)
Still getting the "#Error". Will keep trying... Thanks again for the help.

Douglas J. Steele said:
Just noticed that the parentheses are off as well.

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06# And [q1Main.CaseType]='CUS'")

Sorry about that.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


zSplash said:
Thanks, Doug. Now, instead of getting 0 as the count, I'm getting
#Error. What does that type of error indicate? (Once again, I know
there's something to count.)

Douglas J. Steele said:
Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does
anyone see something goofy in my code?

TIA
 
Z

zSplash

I misspelled something. Oops. Your code works great. Thanks!

Now, if instead of the coded dates
([q1Main.DRef]>=#06/01/02# And [q1Main.DRef]<=#06/30/06#)
I want to add the dates from a parameterForm, it would seem like this would
work:

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=[Forms]![fgetStats]![tbxBegDate]
And (q1Main.DRef)<=[Forms]![fgetStats]![tbxEndDate]) And
[q1Main.CaseType]='CUS'")

It doesn't. Do I have another paren messed up, or something worse?

TIA, AA

zSplash said:
Thanks for that. (I had just added a paren at the end of the statement.)
Still getting the "#Error". Will keep trying... Thanks again for the
help.

Douglas J. Steele said:
Just noticed that the parentheses are off as well.

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06# And [q1Main.CaseType]='CUS'")

Sorry about that.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


zSplash said:
Thanks, Doug. Now, instead of getting 0 as the count, I'm getting
#Error. What does that type of error indicate? (Once again, I know
there's something to count.)

Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does
anyone see something goofy in my code?

TIA
 
Z

zSplash

Never mind, Doug. I see the errors myself. (About time, eh?) Thanks for
everything.

zSplash said:
I misspelled something. Oops. Your code works great. Thanks!

Now, if instead of the coded dates
([q1Main.DRef]>=#06/01/02# And [q1Main.DRef]<=#06/30/06#)
I want to add the dates from a parameterForm, it would seem like this
would work:

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=[Forms]![fgetStats]![tbxBegDate]
And (q1Main.DRef)<=[Forms]![fgetStats]![tbxEndDate]) And
[q1Main.CaseType]='CUS'")

It doesn't. Do I have another paren messed up, or something worse?

TIA, AA

zSplash said:
Thanks for that. (I had just added a paren at the end of the statement.)
Still getting the "#Error". Will keep trying... Thanks again for the
help.

Douglas J. Steele said:
Just noticed that the parentheses are off as well.

=DCount("[DRef]","[q1Main]","[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06# And [q1Main.CaseType]='CUS'")

Sorry about that.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Thanks, Doug. Now, instead of getting 0 as the count, I'm getting
#Error. What does that type of error indicate? (Once again, I know
there's something to count.)

message Your quotes are wrong.

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]>=#06/01/02# And
[q1Main.DRef]<=#06/30/06#) And [q1Main.CaseType]='CUS'")

(that's And [q1Main.CaseType]= ' CUS ' " at the end)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am using the following for a form's textbox controlSource:

=DCount("[DRef]","[q1Main]",("[q1Main.DRef]">=#06/01/02# And
"[q1Main.DRef]"<=#06/30/06#) And "[q1Main.CaseType]"="CUS")

The count is 0, but I know the count should be larger than 0. Does
anyone see something goofy in my code?

TIA
 

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

Top