record criteria

A

AttackIP

I have a table of members all of whom have a unique membership number. I
need a query to pull records on several members at once by the membership
number. i.e. a criteria like (1131, 1326, 3815...) I would need to enter
multiple various (not random) mem numbers on a form, and query those records.
I can query them individually, or get all records Between any two records;
but that's not what I need here... Help

Thanks!
 
G

giorgio rancati

Hi AttackIP,

try this query
----
SELECT *
FROM Table1
Where ',' & Forms!MyForm!txtCriteria & ',' LIKE '*,' & [membership number] &
',*'
-----
for example, the values in txtCriteria are "1131, 1326, 3815"

I hope to have understood :)

bye
 
O

Ofer

I think that what you looking for is

Select * from TableName Where memberNum In ( (1131, 1326, 3815)
 
A

AttackIP

OK good, now how do I run that query from a form that my non-Access
knowledgable users can utilize?
 
G

giorgio rancati

Hi Ofer,
no, if you want to put the criteria in a textbox, it is necessary to use the
Like or the Instr function.

bye
 
G

giorgio rancati

Hi Ofer,
no, if you want to put the criteria in a textbox, it is necessary to use the
Like or the Instr function.

I see that it was not asked for :)

bye
 
O

Ofer

Hi Giorgio
For thts certain criteria, where there are few nubers to filter on, and
there are no rules or order, I can't see how you can use anything but the In()
If we need to use the criteria from a Text box, to display the query with
the right filter, I would change the SQL of the Query after the user enter
the critera 1,4,8,22,44,66

Application.CurrentDB.QueryDefs("QueryName").Sql = "Select * From TableName
Where FieldName In (" & Me.TextBox & ")"


giorgio rancati said:
Hi Ofer,
no, if you want to put the criteria in a textbox, it is necessary to use the
Like or the Instr function.

bye
--
Giorgio Rancati
[Office Access MVP]


Ofer said:
I think that what you looking for is

Select * from TableName Where memberNum In ( (1131, 1326, 3815)


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck
 
Top