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