View Full Version : Form open not applying filter


arage
01-07-2001, 06:25 PM
Hi,
The open event of my form is not applying the filter I request based on the docmd object I specify. I am not using a filter name as an argument in my function, just a valid where condition. As it stands the form opens w/all records instead of the filtered ones. Wud appreciate any thoughts.

Here’s my problem code.

Public Sub Form_Open(Cancel As Integer)

If Forms![menu]!txtHiddenCode = 1099 Then
DoCmd.ApplyFilter ([RegionalDirector] = "Kevin")
End If

End Sub

ntp
01-07-2001, 07:24 PM
I believe the format for the ApplyFilter method is something like
DoCmd.ApplyFilter [FilterName,][WhereCondition]

therefore your code should read
DoCmd.ApplyFileter , "[RegionalDirector] = 'Kevin'"