Full Version: Using Textbox In Report As Wildcard Function Search‎
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
hellabop
Access 2010

Hi all.
I have been battling over this for more than 6 hours now...

On a report I have a Text Box named 'MyTextBox'
Next to it a button with a caption 'Go'

What I would like is for the user to type in a Surname of a customer and the report filters all records for that surname.

On the button I have the following code:-

Dim strFilter As String
strFilter = "[Surname] Like """ & Me![MyTextBox] & "*"""
DoCmd.OpenReport "CustomerRecords", acViewReport, , strFilter

However at the moment whatever is typed into the Text Box displays all records...
iconfused.gif
PaulBrand
Just poking but are you missing an asterix?

CODE
Dim strFilter As String
strFilter = "[Surname] Like ""*" & Me![MyTextBox] & "*"""
DoCmd.OpenReport "CustomerRecords", acViewReport, , strFilter
hellabop
Hi, It still doesn't work...
frown.gif

(thanks for the quick reply)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.