refer to table in IN("") function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to use the contents of a colum in a table as the arguement in an
IN("") method.

e.g

select * from tbl_1

where x In ("[tbl_2].[column_A]")

This will save me having to change all the IN arguements in my queries each
time the department changes its search criteria.

Please help.
 
Try

select * from tbl_1
where x = DlookUp("column_A","tbl_2")

If you are planning to save few values in this field, an this is why you are
using In, it wont work.
For example, if the values in the table are 1,4,6 and you wont to filter the
query to display the records that has this values, the query will look for a
records that contain this string "1,4,6" so it wil be like

select * from tbl_1
where x = "1,4,6"
 
sebastian stephenson said:
I would like to use the contents of a colum in a table as the arguement in
an
IN("") method.

e.g

select * from tbl_1

where x In ("[tbl_2].[column_A]")

This will save me having to change all the IN arguements in my queries
each
time the department changes its search criteria.

select * from tbl_1 where x In (Select [column_A] from [tbl_2])

Keith.
www.keithwilby.com
 
Or just use an inner join if it is appropriate

SELECT tbl1.*
FROM Tbl1 INNER JOIN Tbl2
ON Tbl1.X = Tbl2.Column_A


Keith Wilby said:
"sebastian stephenson" <[email protected]>
wrote in message
I would like to use the contents of a colum in a table as the arguement in
an
IN("") method.

e.g

select * from tbl_1

where x In ("[tbl_2].[column_A]")

This will save me having to change all the IN arguements in my queries
each
time the department changes its search criteria.

select * from tbl_1 where x In (Select [column_A] from [tbl_2])

Keith.
www.keithwilby.com
 
Back
Top