472,127 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Filter multiple results by user input

I have created an append query that pulls information from one
database, and will append the selected information into a new table.
The fields are setup like 'number' 'category' 'code' 'shares' and
'dollars'. Using the "backend" of this table I can filter the numbers
by right clicking and using Filter For: then enter 1 or 2 or 3 and
this will return results for all information that has 1 or 2 or 3 as a
number.

However, the problem I have is that other users will be using this
form by a macro and will be requested to input all the necessary
information because I don't want them messing around in the tables. I
have created a filter query to try to filter the 'number' field and my
criteria reads [Enter: number] but this only allows the user to enter
one number and then the query will execute. Therefore, the user will
only have information that had 1 as a number.

What would be a better criteria to use to allow the user to input
multiple numbers (like I did in the Filter For: 1 or 2 or 3) and have
the query return all the results requested?

Oct 31 '07 #1
1 2736
On Oct 31, 4:43 pm, Barb.Richa...@gmail.com wrote:
I have created an append query that pulls information from one
database, and will append the selected information into a new table.
The fields are setup like 'number' 'category' 'code' 'shares' and
'dollars'. Using the "backend" of this table I can filter the numbers
by right clicking and using Filter For: then enter 1 or 2 or 3 and
this will return results for all information that has 1 or 2 or 3 as a
number.

However, the problem I have is that other users will be using this
form by a macro and will be requested to input all the necessary
information because I don't want them messing around in the tables. I
have created a filter query to try to filter the 'number' field and my
criteria reads [Enter: number] but this only allows the user to enter
one number and then the query will execute. Therefore, the user will
only have information that had 1 as a number.

What would be a better criteria to use to allow the user to input
multiple numbers (like I did in the Filter For: 1 or 2 or 3) and have
the query return all the results requested?
I hope I understand your question correctly.
I am going to assume that you would like to avoid using code do this -
so we'll try although we'll need to add one command.
Let's call the table that holds your data tInfo.
Create a local table (not on the backend so each user will have their
own separate copy) and call it tCriteria
tCriteria has one field 'Number' (although I would not name it that,
it is a reserved word).
Create a continuous form - let's call it fCriteria. It will show the
data from tCriteria
Create a continuous form - let's call it fInfo.
fInfo's recordsource should be tInfo linked to tCriteria by the
'number' field.
Create a 'single form' view form and call it fMain.
Put both fCriteria and fInfo as subforms in fMain.
Here is the only code:
Go into the properties of fCriteria (make sure it's this form and
not fMain),
go to the events tab,
choose afterupdate,
choose [event procedure],
click on the elipsis (the buton with 3 dots on the end) and it will
take you to a code window.
Your code should look like
Private Sub Form_AfterUpdate()
me.parent.refresh
End Sub
Do the same thing for 'After Del Confirm'
Your code should look like
Private Sub Form_AfterDelConfirm(Status As Integer)
Me.Parent.Refresh
End Sub

Now when you open fmain you can type a number into fCriteria subform
and the data will show in fInfo subform.
Delete the numbers you don't want to see from fCriteria.
Now you can adjust the size and format of your subforms so that
everything looks nice and is an easy size to use.

If you are already proficient in code, you can do something similar,
more elegantly, using a list box and multi selecting items.
Good luck
P



Nov 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Edward Burns | last post: by
reply views Thread by CSDunn | last post: by
2 posts views Thread by Seth Delaney | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.