Taking value and using it to search tables

  • Thread starter Thread starter Woodies_46
  • Start date Start date
W

Woodies_46

Can someone tell me if this is close and if it can be done

IF ctl.control Source in CurrentDb.Querydefs("Maps and Plans Query")
then
Wherestr = Wherestr & "(((" & "[Table_name].[colum name]" & ")" & "="
& "" " & ctl.Control Source & "" " & ")"


What i'm trying to do is to get it to check to see if the text writin
in ctl.control Source is in the Maps and Plans Query somewhere then if
it is then i would like it to write it to the string called wherestr.


Thanks Nathan
 
What you've got definitely has some syntactical errors in it.

For one thing, the name of the property is ControlSource (no space), and you
cannot use In in the manner you're trying.

And while it's not the cause of problems, your where string is more
complicated than necessary: while Access may put all those parentheses,
they're not required:

Wherestr = Wherestr & "([Table_name].[colum name])=""" & _
ctl.ControlSource & """)"

Note, too, that you're putting a space before and after what's in
ctl.ControlSource in what you have.

Can you give an example of what you're looking for?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Can this be done. 3
List Box and Query 3
List Box Coding Problem 1
Code Issue 1
Returning multiple records 1
Code for List Boxes 17
Require fields and refresh 14
Code For Required Fields 2

Back
Top