I have a main form (frmClientMasterSearchAdv) with several unbound controls that will be used to filter a subform (subfClientMasterSearch) listing a bunch of records from a sql query. The controls in the header of the main form create a string (strWhere) when the appropriate button is clicked in the header, which is then be applied to the subform's filter. The problem comes up when applying that filter to the subform. I must be referencing it wrong(?)
The error I get is:
Run-time error '2450'
...can't find the form 'subfClientMasterSearch' referred to in a macro expression or VB code.
Here's what I've got:
The error I get is:
Run-time error '2450'
...can't find the form 'subfClientMasterSearch' referred to in a macro expression or VB code.
Here's what I've got:
Code:
'************************************************************************
'Chop off the trailing " AND " and decide if there is any search criteria
'************************************************************************
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
If MsgBox("List all records?", vbYesNo, "No Criteria") = vbYes Then
[Forms]![subfClientMasterSearch].Visible = True
[Forms]![subfClientMasterSearch].FilterOn = False
Else
[Forms]![subfClientMasterSearch].Filter = "(False)"
[Forms]![subfClientMasterSearch].FilterOn = True
End If
Else
strWhere = Left$(strWhere, lngLen)
[Forms]![subfClientMasterSearch].Filter = strWhere
[Forms]![subfClientMasterSearch].FilterOn = True
End If