record criteria

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

Guest

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!
 
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
 
I think that what you looking for is

Select * from TableName Where memberNum In ( (1131, 1326, 3815)
 
OK good, now how do I run that query from a form that my non-Access
knowledgable users can utilize?
 
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
 
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
 
Back
Top