473,832 Members | 2,301 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help With Expression Please

=DCount("*","Cl ients","[Therapy1] = '1'")+DCount("* ","Clients" ,"[Therapy2]
= '1'")+DCount("* ","Clients" ,"[Therapy3] =
'1'")+DCount("* ","Clients" ,"[Therapy4] =
'1'")+DCount("* ","Clients" ,"[Therapy5] =
'1'")+DCount("* ","Clients" ,"[Therapy6] = '1'")

The above works fine. It sums up the number of therapists who specialise
in a particular treatment. I need to add which therapists are active
(available). I have tried doing this with the AND function, but I have not
got it quite right.

=DCount("*","Cl ients","[Therapy1] = '1'")+DCount("* ","Clients" ,"[Therapy2]
= '1'")+DCount("* ","Clients" ,"[Therapy3] =
'1'")+DCount("* ","Clients" ,"[Therapy4] =
'1'")+DCount("* ","Clients" ,"[Therapy5] =
'1'")+DCount("* ","Clients" ,"[Therapy6] = '1'") AND [Active] = '1'"

It's the bit on the end that does not work. I have tried adding/removing
quotes to no avail. The 'Active' column comes from the same table. Active
can be 1 or 2 (not active).

I have also posted this to comp.databases. ms-access

TIA
Dec 1 '05 #1
3 1573
Your statement is attempting to AND [Active] = 1 to the sum of the DCounts.
I seriously doubt that was your intent. You cannot AND additional criteria
to each DCount with this statement which I think was your intent.

Consider including that Criteria in a Query that you use as the basis of the
DCounts instead of the table "Clients".

As an aside, it appears you have multiple fields for the same purpose
defined in your Table, which is not good relational design practice. You
might find life easier if you redesig to use a Therapy table, with each
record indicating the kind of therapy and related to a record in the Client
table.

Larry Linson
Microsoft Access MVP

"Saxman" <john.h.william s(removethis)@b tinternet.com> wrote in message
news:12******** *************** *******@40tude. net...
=DCount("*","Cl ients","[Therapy1] = '1'")+DCount("* ","Clients" ,"[Therapy2]
= '1'")+DCount("* ","Clients" ,"[Therapy3] =
'1'")+DCount("* ","Clients" ,"[Therapy4] =
'1'")+DCount("* ","Clients" ,"[Therapy5] =
'1'")+DCount("* ","Clients" ,"[Therapy6] = '1'")

The above works fine. It sums up the number of therapists who specialise
in a particular treatment. I need to add which therapists are active
(available). I have tried doing this with the AND function, but I have
not
got it quite right.

=DCount("*","Cl ients","[Therapy1] = '1'")+DCount("* ","Clients" ,"[Therapy2]
= '1'")+DCount("* ","Clients" ,"[Therapy3] =
'1'")+DCount("* ","Clients" ,"[Therapy4] =
'1'")+DCount("* ","Clients" ,"[Therapy5] =
'1'")+DCount("* ","Clients" ,"[Therapy6] = '1'") AND [Active] = '1'"

It's the bit on the end that does not work. I have tried adding/removing
quotes to no avail. The 'Active' column comes from the same table.
Active
can be 1 or 2 (not active).

I have also posted this to comp.databases. ms-access

TIA

Dec 1 '05 #2
On Thu, 01 Dec 2005 17:14:33 GMT, Larry Linson wrote:
Your statement is attempting to AND [Active] = 1 to the sum of the DCounts.
I seriously doubt that was your intent. You cannot AND additional criteria
to each DCount with this statement which I think was your intent.

Consider including that Criteria in a Query that you use as the basis of the
DCounts instead of the table "Clients".

As an aside, it appears you have multiple fields for the same purpose
defined in your Table, which is not good relational design practice. You
might find life easier if you redesig to use a Therapy table, with each
record indicating the kind of therapy and related to a record in the Client
table.

Larry Linson
Microsoft Access MVP

Thanks for that. I am in agreement with what you state regarding different
tables. Trouble is, these customers keep asking for more, and I ain't
getting paid for it............. ..
Dec 1 '05 #3
On Thu, 01 Dec 2005 17:14:33 GMT, Larry Linson wrote:
Your statement is attempting to AND [Active] = 1 to the sum of the DCounts.
I seriously doubt that was your intent. You cannot AND additional criteria
to each DCount with this statement which I think was your intent.

Consider including that Criteria in a Query that you use as the basis of the
DCounts instead of the table "Clients".

As an aside, it appears you have multiple fields for the same purpose
defined in your Table, which is not good relational design practice. You
might find life easier if you redesig to use a Therapy table, with each
record indicating the kind of therapy and related to a record in the Client
table.

Larry Linson
Microsoft Access MVP


This worked eventually.

=DCount("*","Cl ients","Active = '1' AND (Therapy1='1' OR Therapy2='1' OR
Therapy3='1' OR Therapy4='1' OR Therapy5='1' OR Therapy6='1' OR Therapy6
='1')" )
Dec 1 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2311
by: Ben Thomas | last post by:
Hi all, I'm having some trouble understanding the behavior of std::ostringstream. (I'm using Visual Studio .Net & STL port 4.5.3). I'll appreciate if someone can give me a little explanation of this behavior and how it is possible... Here's my code ////////////////////////// #include <stdio.h>
7
1773
by: tjshadyluver | last post by:
ok i have gotten this damn project almost done but i am frustrated on this one step. getting 18-35 together and 36-50 and so on. here is my code how can i get them combined in one line instead of writing it out a million times. please help me. i have to write a program that you type in the age and it stores it in a text file then i have to catagorize them and when i hit the read button it shows how many times 18-35 was typed in, then how...
1
2290
by: TAM | last post by:
Hi, I have a simple JavaScript code that ensures that all the form fields are filled and there is also a function that checks if the email is a valid address. For some reason IE is giving "Object Expected" error on the alert statement. The same code doesn't give an error in NN or Opera or Mozilla or FireFox. Can someone give me a clue as what could be wrong here?
2
1475
by: hillcountry74 | last post by:
Hi, I'm stuck with this regular expression from past 2 days. Desperately need help. I need a regular expression that will allow all characters except these *:~<>' This is my code in VB.Net- Dim regex As System.Text.RegularExpressions.Regex
6
2152
by: John Baker | last post by:
Hi: As those who have looked at this newsgroup recently will realize, I am a neophyte with Access, although I have experienced with Approach (the Lotus product). There are things I could easily do in Approach that appear to require some subtle and complex manipulation in Access. Herein lies my present problem. I have a number of tables, including one called "tblPO", which contains purchase orders. Some of the details of these change...
7
14159
by: Jeff | last post by:
Hi - For my VB.NET app, I have a SQL2K database that I use to create a dataset with multiple data tables. I've created a dataview (dvReportsTo) of one of the tables, SCPMaster, and I've bound a combobox control to that dataview. I'm trying to filter the dataview based on values in a second table (ReportsTo) in the same dataset, and it's not working. If it's possible to do this, please help me figure out what I've done wrong and how...
1
3728
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
14
2162
by: JNariss | last post by:
Hello, I am fairly new to asp and jscript and am now in the process of learning some form validation. I am taking one step at a time by validating each field and testing it before moving onto the next one to be sure I am correct. I ran into a problem with my validation when I added an else if code to my code. Here is what I tried to do: Form (ITTermination) has a field (EmployeeName) which I would like to validate to check for no...
4
1929
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: cond(c,a,b)
3
1845
by: Mr.Steskal | last post by:
Posted: Wed Jul 11, 2007 7:01 am Post subject: Regular Expression Help -------------------------------------------------------------------------------- I need help writing a regular expression that only returns part of a string. For Example I have a multi-line text fragment like below:
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4420
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3968
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3077
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.