Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCount syntax headache 1

Status
Not open for further replies.

AccessAddict

Technical User
Apr 30, 2003
32
0
0
GB
Hi

Could someone please have a look at the following for me

If DCount(&quot;*&quot;, &quot;tblMemos&quot;, &quot;[NoteDate] < Date() - '&quot; & Myint & &quot;'&quot; AND IsNull &quot;[(ActionNotes]&quot;) = 0 Then etc



Basically I just want to check if [NoteDate] is less than two days before today AND the contents of a memo field [ActionNotes] is null (both are fields in tblMemos). It works fine checking the date part, but not when I add the AND IsNull &quot;[ActionNotes]&quot; part. I know I'm missing either an & or single or double quotes but my poor brain is frazzelled trying to get them in the right place.

Assistance in unfrazzling my tired brain is much apreciated

Cheers

Alan
 
First, if MYINT is a number, you need to drop the single quotes

[tt]If DCount(&quot;*&quot;, &quot;tblMemos&quot;, &quot;[NoteDate] < Date() - &quot; & Myint & &quot; AND IsNull &quot;[(ActionNotes]&quot;) = 0[/tt]

Try that.

Jim DeGeorge [wavey]
 
Hi Jim

Thanks for the reply. Still getting the type mismatch error even dropping the single quotes (MyInt is an integer)

If DCount(&quot;*&quot;, &quot;tblMemos&quot;, &quot;[NoteDate] < Date() - &quot; & Myint & &quot;&quot; _
And IsNull(&quot;[ActionNotes]&quot;)) > 0 Then

Any other ideas?

Thanks again

Alan
 
Hi Alan, Jim,

This should work ok, I think!:
If DCount(&quot;*&quot;, &quot;tblMemos&quot;, &quot;[NoteDate] < Date() - &quot; & MyInt & &quot; And IsNull([ActionNotes])&quot;) > 0 Then

Bill
 
Hi Jim

That did the trick. Thanks a million

Cheers

Alan
 
Alan

It was Bill who properly formatted the IsNull on your last part of the syntax, so he should get the thanks (and a star from me!).

Jim DeGeorge [wavey]
 
Thanks Jim,

That's very noble of you. Keep up the good work, thanks again.

Bill
 
Bill...

I can't count the number of times that you've helped me in the past (among hundreds of others). You'll probably forget more about Access that most of us will ever know!

Jim DeGeorge [wavey]
 
Hi Bill

Oooops, my apologies. I didn't notice a different poster, but many thanks for your solution to my latest headache - and also for your post Jim. Without help from people such as yourselves there would be a lot of non functioning db's!!

Thanks again

Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top