Counting Day Of Wk

N

NotGood@All

I use this code to count the # of things that happened on that day of the
week - xSun: Count(IIf(Format([ToDaysDate],'w')=1,1,Null)). It works in
program A. My boss saw it and wanted me to add it do something he does. I
copied the code, created a new query using his table, changed the name of the
field, but get a data-mismatch, I checked, both fields are short dates using
the same format. Can someone please tell me what I'm missing

Thank You!
 
D

Douglas J. Steele

Actually, it shouldn't be working for you!

The Format function returns a string, not a number, so you should be
comparing = "1", not = 1. Either that, or you should be using the Weekday
function:

xSun: Count(IIf(Weekday([ToDaysDate])=1,1,Null))
 
N

NotGood@All

Douglas, Thanks! You are correct, I re-opened the form and it gave me the
error, I assumed it would work because it did not error out when I wrote the
code.
--
NotGood@All


Douglas J. Steele said:
Actually, it shouldn't be working for you!

The Format function returns a string, not a number, so you should be
comparing = "1", not = 1. Either that, or you should be using the Weekday
function:

xSun: Count(IIf(Weekday([ToDaysDate])=1,1,Null))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


NotGood@All said:
I use this code to count the # of things that happened on that day of the
week - xSun: Count(IIf(Format([ToDaysDate],'w')=1,1,Null)). It works in
program A. My boss saw it and wanted me to add it do something he does.
I
copied the code, created a new query using his table, changed the name of
the
field, but get a data-mismatch, I checked, both fields are short dates
using
the same format. Can someone please tell me what I'm missing

Thank You!
 

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