I've been struggling with this problem for a few days now. The table looks like this
T_PROJECT_FILES
fields: projectId, unitIdNow, I want to count the number of records with different values in unitId, but with a specific value (e.g. 1) in projectId. The value of 'projectId' is coming from another form using e.g.
Expand|Select|Wrap|Line Numbers
- Forms!F_Start.lblActiveProjectId.caption
I have previously tried to make a query like this (I called it Q_PROJECT_FILES_UNITCOUNT):
Expand|Select|Wrap|Line Numbers
- SELECT T_PROJECT_FILES.unitId, T_PROJECT_FILES.projectId
- FROM T_PROJECT_FILES
- GROUP BY T_PROJECT_FILES.unitId, T_PROJECT_FILES.projectId
- HAVING (((T_PROJECT_FILES.projectId)=[Forms]![F_Start]![lblActiveProjectId].[caption]));
Expand|Select|Wrap|Line Numbers
- Dim db As Database
- Dim rs As DAO.Recordset
- Dim qdf As QueryDef
- Set db = CurrentDb
- Set qdf = db.QueryDefs("Q_PROJECT_FILES_UNITCOUNT")
- Set rs = qdf.OpenRecordset()
Any suggestions?