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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Predefined filters on a form 2

Status
Not open for further replies.
Oct 20, 2003
193
GB
Hi all

Let me try and explain this correctly first time!

I have a main form which allows you to match members of staff to three source datasets. Some of the staff are in in some or all of the source databases and some are in none. At the bottom of the form are subforms for each data set showing existing matches.

I have a seperate form (launched from the above form) for each set of source data which by default is in continuous forms view. The intention is for the form header to have a set of buttons on it which will apply useful filters to the data (Match surname/forename/first letter of surname to the currently selected record on the main form. As well as a button which will allow them to create their own filter.)

The default wizard allows you create buttons to edit the filter or apply it but I'm not sure how you go about applied a pre-defined filter.

Please assist.
 
You can set the filter property of a form, for example:

[tt]Me.Filter="Surname='" & Forms!MainForm!Surname & "'"
Me.FilterOn=True[/tt]
 
You can set the filter to an empty string:

[tt]Me.Filter =""[/tt]

Or simply turn it off:

[tt]Me.FilterOn=False[/tt]
 
Thanks once again!

On more, slightly more complicated, I want a filter that will match the first letter of the first name and the first letter of the surname.

For the forename I have:
Code:
Me.Filter = "left (Forename,1)*='" & left (Forms!Staff!FORENAME),1* & "'"

I know the syntax is all wrong but I can't gifure out HOW it's wrong
 
what about this ?
Code:
Me.Filter = "Left(Forename,1)='" & Left(Forms!Staff!FORENAME,1) & "'"
Or this ?
Code:
Me.Filter = "Forename Like '" & Left(Forms!Staff!FORENAME,1) & "*'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Perfect

I went with the second which seemed more elegant to me

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top