I have a form that is filtered on open to show only records aligned to the rep that logged in. That filter works fine.
What I am trying to do is have a button to show them the records they have not touched yet. I was trying to use ApplyFilter like this
Code:
Private Sub Command395_Click()
DoCmd.ApplyFilter , "SELECT tblMain.* FROM tblMain LEFT JOIN tblActivities ON tblMain.Account = tblActivities.Account WHERE (tblActivities.[Activity Create Date]IS NULL) AND tblMain.Employee_Number = Forms.Logon_Form.cboEmployee"
End Sub
But I constantly get runtime error 3075 saying there is a syntax error.
I also have an unfilter button that removes other filter options the rep can apply and I would like the above uncontacted filter to be removed by this unfilter button as well.
The unfilter presently looks like this
Code:
[Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control
Dim strWhere As String
'Clear all the controls in the Form Header section.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
'Remove the form's filter.
Me.Filter = strWhere & "[Account Name] Like '*" & Me.AccountName & "*' AND [Employee_Number] = '" & Forms!Logon_Form!cboEmployee & "'"
' Me.FilterOn = False
'Forms!frmMain.RecordSource = "QueryTblMain"
'DoCmd.Requery
End Sub
Any help would be appreciated.