?
Solved

Proper Dcount Syntax

Posted on 2013-11-13
2
Medium Priority
?
342 Views
Last Modified: 2013-11-13
I have the following rowsource in a list box pulling data to display... which is working:

SELECT Count(*) FROM Tpatient WHERE (((Tpatient.RecallNumber)=0) And ((Date()-TPatient!LastApmnt)>(TPatient!RecallFreq*30)) And ((TPatient!RecallActive)=-1)) Or (((Date()-TPatient!RecallNotice)>30) And ((Tpatient.RecallFreq)<12) And ((Tpatient.RecallNumber)<4) And ((Date()-TPatient!LastApmnt)>360) And ((TPatient!RecallActive)=-1)) Or (((Date()-TPatient!RecallNotice)>30) And ((Tpatient.RecallFreq)>=12) And ((Tpatient.RecallNumber)=1) And ((TPatient!RecallActive)=-1));

SELECT Count(*) FROM TPatient WHERE (((TPatient.FirstVLetter)=0) AND ((TPatient.RecallActive)=-1) AND ((TPatient.Zip) Is Not Null));

I would like to change each of these to for use in VBA with a DCount to obtain their value.  I am not able to get the syntax correct.

Is this possible and if so what should the proper syntax be for DCount?
0
Comment
Question by:thandel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
chaau earned 2000 total points
ID: 39646964
Syntax for the first case:
DCount("*", "Tpatient" , "(((Tpatient.RecallNumber)=0) And ((Date()-TPatient!LastApmnt)>(TPatient!RecallFreq*30)) And ((TPatient!RecallActive)=-1)) Or (((Date()-TPatient!RecallNotice)>30) And ((Tpatient.RecallFreq)<12) And ((Tpatient.RecallNumber)<4) And ((Date()-TPatient!LastApmnt)>360) And ((TPatient!RecallActive)=-1)) Or (((Date()-TPatient!RecallNotice)>30) And ((Tpatient.RecallFreq)>=12) And ((Tpatient.RecallNumber)=1) And ((TPatient!RecallActive)=-1))")

Open in new window


Syntax for the second case:
DCount("*", "TPatient", "(((TPatient.FirstVLetter)=0) AND ((TPatient.RecallActive)=-1) AND ((TPatient.Zip) Is Not Null))")

Open in new window

0
 

Author Closing Comment

by:thandel
ID: 39646973
OK that was pretty straight, not sure why it wasn't working for me... I think I was missing a quote.  Thank you.
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question