Change the report header to a text box (instead of a label) so it will be programmable. Also, add a hidden text box anywhere in the report header section. This can be either bound (if it gets its data from the report's recordsource), or unbound (if it gets the data from VBA). You might call the hidden textbox "txtTWord."
In the report header text box, the Control Source is (for example)
="All Training Course Names That Contain the Word *" & Me.txtTWord & "*"
Don't forget the "=" in front.
The reason I use this system is so I don't skewer the text because of an extra-short or extra-long text value in a text box.
I'm not sure I understand.... I copied the code you sent me - it is not returning the word that is entered into the query between the * asterisks.
I tried changing the Me.TxtTWord to my field name that the query is pulling on: CourseDescription.TxtTWord.... still nothing - I'm getting the #Name?error. Since the query is combining a few different tables I thought maybe I needed the Table Name too: [CourseRequirements].[CourseDescription].txtTWord. Using either of my changes automactically puts in the brackets around txtTWord.
This is in the text box that is not hidden. Also, why do I need to have a hidden text box?
Attached is a screen print of the query in case you need information on it.
Two things leap out at me from the query that you uploaded. One is that there are no joins at all for the tables CourseRequirements or Employee. There should at least be one Inner Join each to TrainingRecords.
The second thing is that your criteria line should read
Like "*" & [Enter Course Name] & "*"
This is because the text between the brackets is considered like a variable. If you provide the "*" (in order to satisfy the 'Like' keyword) on both sides, you don't need it when you run the query. That's why I hard-coded the two "*" in the header text box.
The purpose for the hidden textbox is so you don't have two text boxes with the same information. If it's hidden, it'll only appear in the header.
I'm still have difficulties with the other code - still getting the same error message and i get a "pop-up" asking for the "Me" of the code. What am I doing wrong?!?!?
I've attached another screen shot of what the text box code looks like.
The text box that's labeled "Text38" should be named "txtTWord". Not the label, the text box. Since you made it unbound, that means it's getting its value from VBA in the Report Header section of the report.
Unfortunately, I have to run now, and I won't be available until Sunday at the earliest, and more likely Monday afternoon. Please try to understand where I'm heading, and don't hesitate to look at the Help file. It's really helpful. Also, maybe someone else on the forum would like to lend a hand.