Count of Group Query (1 Viewer)

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
Nice evening everyone I have this query based on calculating a particular specialty or a specific case and it gives me the results of the sum of each specialty in the form of a group. What I want to do is to double-click on a particular specialty in this query, it will take me to those with this specialization through another query and filter them from among all the specializations. For example, the first query shows me the group of wheel drivers, numbering seven people. When I double-click on the wheel drivers, the event goes to another query and shows me only these seven people, and so on. Thank you so much .
Code:
SELECT tblMastr.JobStatus, Count(tblMastr.JobStatus) AS CountOfJobStatus
FROM tblMastr
GROUP BY tblMastr.JobStatus;
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
You could use a Form to display your query, so you can use Form and Control events to drilldown further into the data.
 

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
You could use a Form to display your query, so you can use Form and Control events to drilldown further into the data.
Thank you theDBguy for the quick response, my friend. Yes, this is exactly what I did, but what I want is to move to the other module that contains the specialization filter that I referred to at the beginning of my topic. The first query is already on a form and the second query is also on a form. But the second form shows me all the specialties, not based on the count
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
Thank you theDBguy for the quick response, my friend. Yes, this is exactly what I did, but what I want is to move to the other module that contains the specialization filter that I referred to at the beginning of my topic. The first query is already on a form and the second query is also on a form. But the second form shows me all the specialties, not based on the count
So, in your double-click event, you could pass a filter to the second form to reduce the records down to the specific specialty you selected.
 

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
Indeed, what you are saying is accurate theDBguy . Here I stopped and remained puzzled. There is a code I use when I double click but it takes me to the ID number. I want what you just talked about, my friend. This is code that does the same thing as the count function in the query. This event takes me to display the seven records for example. Than double click on CountOfJobStatus
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
Indeed, what you are saying is accurate theDBguy . Here I stopped and remained puzzled. There is a code I use when I double click but it takes me to the ID number. I want what you just talked about, my friend. This is code that does the same thing as the count function in the query. This event takes me to display the seven records for example. Than double click on CountOfJobStatus
You should be able to modify that code to do what you want it to do now. If you need help with that, you will have to post the code, so we can help you update it.
 

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
You should be able to modify that code to do what you want it to do now. If you need help with that, you will have to post the code, so we can help you update it.
Code:
Private Sub FullName_DblClick(Cancel As Integer)
 On Error Resume Next
 Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmMaster"
    
    stLinkCriteria = "[ID]=" & Me![ID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
Code:
Private Sub FullName_DblClick(Cancel As Integer)
On Error Resume Next
Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmMaster"
   
    stLinkCriteria = "[ID]=" & Me![ID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
So, that code opens another form filtered to a specific record ID. What is it that you want it to do differently?
 

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
So, that code opens another form filtered to a specific record ID. What is it that you want it to do differently?
Here it shows me one record number. The group is not dependent on the query that I mentioned at the beginning of my topic. I open these records referred to in the picture. My dear friend, at the beginning of my topic, I mentioned to you that I want to display all records belonging to a particular specialty based on their number in the query.
 

Attachments

  • image_2021-11-03_213827.png
    image_2021-11-03_213827.png
    19 KB · Views: 340

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
Here it shows me one record number. The group is not dependent on the query that I mentioned at the beginning of my topic. I open these records referred to in the picture. My dear friend, at the beginning of my topic, I mentioned to you that I want to display all records belonging to a particular specialty based on their number in the query.
Hi. The picture you posted is an image of a query's SQL statement and not the result of running it. You might want to post a sample db to help us understand what you want to do a little easier. It's always helpful to see a sample set of data to figure out the situation.
 

azhar2006

Registered User.
Local time
Yesterday, 22:02
Joined
Feb 8, 2012
Messages
202
Hi. The picture you posted is an image of a query's SQL statement and not the result of running it. You might want to post a sample db to help us understand what you want to do a little easier. It's always helpful to see a sample set of data to figure out the situation.
Well, my friend, I have attached a database for you. See Form A. It shows you the total number of specialties. In Form B, all employees and their specializations are shown. What I want is when I click on a specific specialization in Form A, the form with these specializations will be shown to me only
 

Attachments

  • New Database.zip
    17.9 KB · Views: 214

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:02
Joined
Oct 29, 2018
Messages
21,358
Well, my friend, I have attached a database for you. See Form A. It shows you the total number of specialties. In Form B, all employees and their specializations are shown. What I want is when I click on a specific specialization in Form A, the form with these specializations will be shown to me only
Thanks. See if this is what you mean.
 

Attachments

  • New Database (2).zip
    27.3 KB · Views: 345

Users who are viewing this thread

Top Bottom