I have the basic report/subreport. There is a link using the department. But I also need to filter the subreport based on the text information in txtCredential on the main report. The problem is that the information on the subreport is based on a query that has yes/no. Lets see if I can be clearer.
Main report: txtCredential is a text box that will be showing RN, LPN, or Unit Clerk.
subreport: the query,qryOrientationChecklistComponents, has RequiredRN, RequiredLPN, and RequiredUC as yes/no fields. I will not be displaying this information on the report only the name of the component these fields ae associated with.
If the txtCredential reads RN then I need from the query qryOrientationChecklistComponents only those components where RequiredRN equals yes to be displayed.
I think I need to do a Select Case statement on txtCredential and do it in the open event of the main form. Is this correct or is there a better way?
I get a 2427 runtime error message. You entered an expression that has no value.
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
Dim strSQL As String
Select Case txtCredential ‘select appropriate components based on credential
Case “RN”
strSQL = ” SSELECT tblComponents.Name, tblComponents.PresentationType, ” & _
“tblComponentDept.RequiredRN, tblComponentDept.RequiredLPN, tblComponentDept.RequiredAide, ” & _
“tblComponentDept.RequiredUC, tblComponentDept.Department ” & _
“FROM tblComponents INNER JOIN tblComponentDept ON tblComponents.ComponentID = tblComponentDept.ComponentID ” & _
“WHERE (((tblComponentDept.RequiredRN)=Yes)) ”
Case “LPN”
strSQL = ” SSELECT tblComponents.Name, tblComponents.PresentationType, ” & _
“tblComponentDept.RequiredRN, tblComponentDept.RequiredLPN, tblComponentDept.RequiredAide, ” & _
“tblComponentDept.RequiredUC, tblComponentDept.Department ” & _
“FROM tblComponents INNER JOIN tblComponentDept ON tblComponents.ComponentID = tblComponentDept.ComponentID ” & _
“WHERE (((tblComponentDept.RequiredLPN)=Yes)) ”
Case “Unit Clerk”
strSQL = ” SSELECT tblComponents.Name, tblComponents.PresentationType, ” & _
“tblComponentDept.RequiredRN, tblComponentDept.RequiredLPN, tblComponentDept.RequiredAide, ” & _
“tblComponentDept.RequiredUC, tblComponentDept.Department ” & _
“FROM tblComponents INNER JOIN tblComponentDept ON tblComponents.ComponentID = tblComponentDept.ComponentID ” & _
“WHERE (((tblComponentDept.RequiredUC)=Yes)) ”
End Select
‘ Execute it
DoCmd.RunSQL strSQL
End Sub
Thank you. Fay