Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple filters

Status
Not open for further replies.

aspnet98

MIS
May 19, 2005
165
US
I am using the following code to set a filter on one of my forms:

Private Sub Form_Open(Cancel As Integer)
'Set unbound textbox = to login name.
Me.LoginName = strUserName

'Apply filter based on Username field.
Me.Filter = "[ReportsTo] = '" & Me.LoginName & "'"
Me.FilterOn = True

End Sub

I need to set another filter for Year. Can I set more than one, if so how? The field is called Year.
 
How about:
Me.Filter = "[ReportsTo] = '" & Me.LoginName & "' And Year=" & intYear
 
And, as Year is a reserved word:
Me.Filter = "ReportsTo='" & Me.LoginName & "' AND [Year]=" & intYear

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top