Solved Need to Count Total (1 Viewer)

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
Hello,
I want to analysis report showing in the dashboard in the footer.
So, can possible a query to displaying total data count Like :
total employee,
Total Active Worker,
Total Nationality,
Total Male and Female
Total NID
Total Iqama etc, more columns in the query attached DB.


Advance thanks and will appreciated any help.
 

Attachments

  • Employee Analysis Report.accdb
    432 KB · Views: 137

theDBguy

I’m here to help
Staff member
Local time
Today, 07:45
Joined
Oct 29, 2018
Messages
21,467
Hi. Have you tried using DCount()?

Sent from phone...
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
Thanks for your reply @theDBguy .
I try Dcount () function
Code:
 =DCount("*","tblEmployee","Country='Bangladesh'")
Its worked.
But I want to input from Query. Then I try
Code:
 =DCount("*","qryTotalWorker","Country='Bangladesh'")
but its result is error..

Why I want to input from query ?
Because, I want to StatusID selection ACTIVE employee and INACTIVE employee result.
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
Thank you for reply.
No its Dcount Function. not query.
Using Dcount, I have completed Total Worker. Nationality.

Now I tred to Active Employee Count. but I dont know why its not work.
try 1
Code:
=DCount("StatusID","tblEmployee","StatusID='Active'")
try 2
Code:
=DCount("StatusID","tblEmployee","StatusID='1'")
also try
Code:
=DCount("*","tblEmployee","StatusID='1'")
All Function given result Error.
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:45
Joined
Sep 21, 2011
Messages
14,257
If it is an ID then I hope it would be numeric? :unsure:
If numeric you do not use quotes :(
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
If it is an ID then I hope it would be numeric? :unsure:
If numeric you do not use quotes :(
Thank you so much @Gasman
it's work.
Left employee have numeric number 2-3-4-5-6 numbers
how I put functions in the criteria.
=DCount("*","tblEmployee","StatusID= ??? ")
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:45
Joined
Sep 21, 2011
Messages
14,257
Thank you so much @Gasman
it's work.
Left employee have numeric number 2-3-4-5-6 numbers
how I put functions in the criteria.
=DCount("*","tblEmployee","StatusID= ??? ")
I do not understand te question.?
It works, you just supply the ID whether it be 123 or 1234 or 12345
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
I do not understand te question.?
It works, you just supply the ID whether it be 123 or 1234 or 12345
Thank you and I appreciate your replies.
I try it LIKE
Code:
=DCount("*","tblEmployee","StatusID=234567")
Result is 0 showed.
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
I give you a screenshot
1603369543351.png
 

Minty

AWF VIP
Local time
Today, 15:45
Joined
Jul 26, 2013
Messages
10,371
Something like
=DCount("*","tblEmployee","StatusID >1 and StatusID < 8")
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:45
Joined
Sep 21, 2011
Messages
14,257
I cannot see how statusID would be an exact number, more like a range as Minty has inferred.? :(
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
Something like
=DCount("*","tblEmployee","StatusID >1 and StatusID < 8")
Thank you so much.
Its work. Display result.
I appreciated.
I have a question ?
If I try to input same data from query table as attached that is not give result, can I know why its not work ?
 

Minty

AWF VIP
Local time
Today, 15:45
Joined
Jul 26, 2013
Messages
10,371
Thank you so much.
Its work. Display result.
I appreciated.
I have a question ?
If I try to input same data from query table as attached that is not give result, can I know why its not work ?
There should be no difference. Can you show the query SQL?
 

smtazulislam

Member
Local time
Today, 17:45
Joined
Mar 27, 2020
Messages
806
Hi, this is my sql
Code:
SELECT tblEmployee.EmployeeID, tblEmployee.EmployeeName, tblEmployee.EmployeeNameAr, tblEmployee.PhoneNumber, tblEmployee.Country, tblEmployee.DeptID, tblEmployee.StatusID, tblEmployee.Religion, tblEmployee.Gender, tblEmployee.IdentityNumbers, tblEmployee.DesignationAr
FROM tblEmployee
WHERE (((tblEmployee.StatusID)=1 Or (tblEmployee.StatusID)=2))
ORDER BY tblEmployee.EmployeeID;
 

Minty

AWF VIP
Local time
Today, 15:45
Joined
Jul 26, 2013
Messages
10,371
Well unless I'm being a bit stupid that query will only give you records with status 1 or 2.

So then counting any with status between 2 and 7 will only give you the count of status 2 records, as that is all that is in the original query output.
 

Users who are viewing this thread

Top Bottom