Solved

Proper Dcount Syntax

Posted on 2013-11-13
2
340 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 500 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

705 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