Query linked to unbound form

Hello Experts:

I need some assistance with some basic VBA/SQL code that updates a dynamic query (linked to an unbound form).

Please find attached database (zipped) for your review.   It contains the following three objects:
1. tblSelfStudyQuestions (with 685 records)
2. qrySelfStudyQuestions
3. frmKeywordSearch

Initial process (which works fine) -- scenario #1:
- Open up query
- When prompted for 1st parameter value, enter "risk"
- When prompted for 2nd parameter value, leave field blank and press enter
- The query returns 12 records

Initial process (which works fine) -- scenario #2:
- Open up query
- When prompted for 1st parameter value, enter "risk"
- When prompted for 2nd parameter value, enter "we"
- The query returns 2 records now

Here's what I currently have (working in the form):
- Previously, I had a single keyword search (in the form) in the top left of the form.   The object is called "txtSearch1"
- So, when opening up the form and typing in "risk", the listbox would show the 12 records... great!

And here's what I need some help with:
- I now added a second keyword search (txtSearch3).  
- Here, for example, I want to type the word "we" in order to further reduce the shown records from 12 to 2.
- At this time, however, once I type the word "risk" in 1st search field (showing 12 records) and then type "we" in the 2nd search field, the number of records changes to "115" (vs. 2).  

My question:  How should the VBA/SQL modified -- in the form (OnChange event procedure) -- to ensure that I display the correct number of records?

Thank you for your help in advance.
EEH
Database.zip
ExpExchHelpAnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IrogSintaCommented:
You need to change the line in your txtSearch3_Change event from
txtSearch2.Value = vSearchString2
to
txtSearch4.Value = vSearchString2

Then add a control named txtSearch4 to your form.  It will work fine then.

Ron
ExpExchHelpAnalystAuthor Commented:
Ron:

Thank you... I actually tried that earlier.   It gives me a compile error "Variable not defined" in the txtSearch_Change() function.

What am I missing?  

EEH
IrogSintaCommented:
As I said, you need to also add a Textbox control to your form and rename it to txtSearch4.

Ron

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ExpExchHelpAnalystAuthor Commented:
Ron:

Perfect... it works like a charm now.   Thousand thanks!

EEH
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.