Multiple criteria in "stLinkCriteria" statement

I have a form with 3 drop-down lists with the names, say, Control1, Control2, Control3.

Control 1 - numeric
Control 2 - text
Control 3 - memo

I am trying to make a button which opens up a form, Form1, based on what is selected in these three textboxes. Control1 will look up the values in Field1, Control2 the values in Field2...(all from a table, Table1, on which Form1 is based.)

However, there seem to be syntax errors in my VB stLinkCriteria statement.

I need the correct syntax to get the button to open Form1 with valid records based on the list box selections.

Thanks
yi_untAsked:
Who is Participating?
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.

flavoCommented:
Try this..
stLinkCriteria = [Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & " and [field3] = '" & Me.control3 & "'"

Dave

0
yi_untAuthor Commented:
Dave,

The last single and double quotes get commented out by VB.
After removing those, I get the following error message on pressing the button to open the form:

---Microsoft Access can't find the field 'l' referred to in your expression.---

(It looks like the letter L in lowercase but is actully much bigger in lenght...I do not have anything like that in my statement!)

I tried manipulating your statement but it produces the same error.

Thanks
0
flavoCommented:
woops, missed a ' and " sorry

stLinkCriteria = "[Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & "' and [field3] = '" & Me.control3 & "'"
0

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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

yi_untAuthor Commented:
That works!

If it's not asking too much, could you show me the stLinkCriteria statement if I had just Field1(numeric) and Field2(text)?

(for 25 additional points?)

thanks.
0
flavoCommented:
stLinkCriteria = "[Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & "'"

Like that??
0
yi_untAuthor Commented:
If not, this answer is fine and I'll 'accept' it.

Kindly let me know. Thanks for your help
0
yi_untAuthor Commented:
I think I forgot to hit submit after adding the points.

Is there a way to reaward them?
0
flavoCommented:
Dont worry mate, its fine, i have plenty :-)

Glad its all working

Good luck eith your project!

Dave
0
yi_untAuthor Commented:
lol

thanks
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.