473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Expression to count number of times event occurrs

I am using the following expression in an access query. The goal is to count from tblAttedance how many times a particular employee (eid) is present (present = yes) for a particular type of event (SDY). Can someone please help? All I keep getting is #Error!!

Expand|Select|Wrap|Line Numbers
  1.  
  2. DCount("tblAttendance_present","tblAttendance","tblAttendance_eID = " & [tblEmployees.tblEmployees_eID] & "AND tblAttendanceType = 'SDY' AND tblAttendance_present = 'Yes'")
  3.  
  4.  
Thank you!!!!
Oct 4 '11 #1

✓ answered by Stewart Ross

Looks to me that there are two problems in your WHERE clause: incorrect bracketing of the first field name (a dot in the middle of the bracketing), and a missing space before the first AND operator. Assuming that the field name in the first part is tblEMployees_eID the syntax should be:

Expand|Select|Wrap|Line Numbers
  1. DCount("tblAttendance_present","tblAttendance","tblAttendance_eID = " & [tblEmployees].[tblEmployees_eID] & " AND tblAttendanceType = 'SDY' AND tblAttendance_present = 'Yes'")
-Stewart

3 1655
Stewart Ross
2,545 Expert Mod 2GB
Looks to me that there are two problems in your WHERE clause: incorrect bracketing of the first field name (a dot in the middle of the bracketing), and a missing space before the first AND operator. Assuming that the field name in the first part is tblEMployees_eID the syntax should be:

Expand|Select|Wrap|Line Numbers
  1. DCount("tblAttendance_present","tblAttendance","tblAttendance_eID = " & [tblEmployees].[tblEmployees_eID] & " AND tblAttendanceType = 'SDY' AND tblAttendance_present = 'Yes'")
-Stewart
Oct 4 '11 #2
Rabbit
12,516 Expert Mod 8TB
I confused as to why you're using a DCount rather than a join.
Oct 4 '11 #3
Thank you! It is now working as
Expand|Select|Wrap|Line Numbers
  1. DCount("tblAttendance_present","tblAttendance","tblAttendance_eID = " & [tblEmployees.tblEmployees_eID] & "AND tblAttendance_Type = 'SDY' AND tblAttendance_present = Yes")
  2.  
This is working beautifully. I'm afraid I got a little too ahead of myself in asking this question before I was completely out of options. I'm sorry. Thank you for the help!
Oct 5 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Feverish | last post by:
I am a bit confused with the two marked lines. I have never seen such syntax even though I read a lot of C++ codes. Thanks for your suggestion... BluetoothReceiver::BluetoothReceiver() :...
3
by: ichor | last post by:
hi i have nt come acroos this syntax in OOP . can you plz explain what this means? public FormsView(DataInstance dataInstance): base(dataInstance) this is a constructor. thnx
3
by: lovecreatesbea... | last post by:
K&R2 sec 8.7 reads: union header{ /*...*/ }; typedef union header Header; /*...*/ Header *morecore(unsigned); /*?*/
1
by: avocado12 | last post by:
Hi, I'm sure this is very basic but it's difficult to google or search for because I'm searching for ":". Can anyone explain or point me to a reference for the ":" operator used in Javascript?...
3
by: Giuseppe:G: | last post by:
Hi, the following piece of code is rather obscure for me struct Foo { Foo( int _x ) : x(_x) {} .... }; what's the meaning of that construct? I understand Foo() must be a constructor,...
5
by: campyhapper | last post by:
I've seen this in C++, not Objective C: namespace bar { struct foo { foo (int a, int b) : int a_, int b_ {} }; }
6
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
double c = double.NaN; Console.WriteLine(c = 10); Console.WriteLine(c += 5); Console.WriteLine(c); output: 10 15 15
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.