• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 773
  • Last Modified:

Use "like" in Docmd.ApplyFilter

I need to filter records on a form.

I use the following code:
DoCmd.ApplyFilter , "StudentLastName = '" & Me.StudentDetails & "'"

This works well if the user enters the exact criterea.

I would like to add a "*" to the criterea so that if the user enters "on", the following are returned:
anyone
on
once
etc

What is the syntax?

0
TimTDP
Asked:
TimTDP
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
StudentLastName LIKE '*" & Me.StudentDetails & "*'"

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now