I can't think how to do this and have tried with the follwoing code. Basically the field in question is :
POL_Change_Allocated - This is a yes/no tick box. I want to filter for all forms where the tick hasn't been applied. (Am I right in thinking that this means this field is no unless ticked?)
The main form feeds from table OCP Base Tables
The Subform feeds from table POL Actions
These two tables are both linked on the form using OCP Ref
I started to write the code below, but realised this would just return non blanks, whereas I am looking to return all forms where "no" is selected. Also I started to get bogged down in the code, but as the filter needs to be on the subform I didnt think I could apply a normal filter.
I am new to both access and VBA so please can you explain what on earth I am doing wrong.
Expand|Select|Wrap|Line Numbers
- Private Sub Pending_Changes_Click()
- Dim strSQL As String
- If IsNull(Me.{POL_Change_Allocated) Then
- ' If the combo is Null, use the whole table as the RecordSource.
- Me.RecordSource = "OCP_Base_tables"
- Else
- strSQL = "SELECT DISTINCTROW tblOCP_Base_Tables.* FROM tblOCP_Base_Tables " & _
- "INNER JOIN tblPOL_Actions ON " & _
- "tblOCP_Base_Tables.OCP_Ref = tblPOL_Actions.OCP_Ref " & _
- "WHERE tblPOL_Actions.POL_Change_Allocated = " & Me.Pending_Changes & ";"
- Me.RecordSource = strSQL
- End If
- End Sub