Stuck on this code.
I have a list box filled with employee names and a command button that opens my form "Projects" filtered by the selected Employee name. I want to take it a step further and add a check box "ckActive" that, if checked shows only Active records (there are 5 other "status" types) and if unchecked shows all status types.
I have tried the following code:
On Error GoTo Err_Select_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Projects"
If Me![ckActive] = True Then
stLinkCriteria = "[projectowner] = " & Me![List5] & " " & _
stLinkCriteria = stLinkCriteria & "[status] = "Active"
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
Doing it this way just opens ALL of the records regardless of what is chosen in my list box.
Thanks!
Toni
I have a list box filled with employee names and a command button that opens my form "Projects" filtered by the selected Employee name. I want to take it a step further and add a check box "ckActive" that, if checked shows only Active records (there are 5 other "status" types) and if unchecked shows all status types.
I have tried the following code:
On Error GoTo Err_Select_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Projects"
If Me![ckActive] = True Then
stLinkCriteria = "[projectowner] = " & Me![List5] & " " & _
stLinkCriteria = stLinkCriteria & "[status] = "Active"
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
Doing it this way just opens ALL of the records regardless of what is chosen in my list box.
Thanks!
Toni