By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

Filter data from another form

P: 2
I need help.

I am new to MS Access and have been assign this project.

I want to be able to filter data from a form that will be displayed on a subform.

I don't know if this is possible but ideally i would like to double click on a field from Form A which will open a subform and display filtered data based on the data's site code that was double clicked.

My database is for a budget tracker

finance data will be entered for different sites. I would like an option for users to be able to click on a field in a form that will open another form so they can edit data which has been filtered for that site.
Sep 19 '08 #1
Share this Question
Share on Google+
5 Replies


P: 53
Hi Mapi,

this all depends on the fields and the data held within them.

you can open a form selecting the Record you wish to alter:

Expand|Select|Wrap|Line Numbers
  1. docmd.OpenForm "<insert Formname>",<select windowmode>,<insert filter>
the filter will be a field containing data consistent with both forms ie a Primary Key or other (preferrably) indexed field.

ie "MyPK=" & me.<field you are double clicking>

hope this helps


Leon
Sep 19 '08 #2

P: 2
I managed to do the first part which is open another form on double click but i can't seem to figure out the filter part. Can you please provide more info on the filter part.

Thanks in advance
Sep 28 '08 #3

P: 53
Hiya,

I think i was a little ambiguous.

does the subform contain the same recordsource (table / query) as the main form?
if so, the filter (or where instruction) would be
"[PK]=" & me.<PK>

thus you are opening the form with the Primary Key of the record, this makes the margin for error a lot less than looking at data itself (unless you are certain it is unique accross the table(s)

Hope this clears it up a little bit

Leon
Sep 30 '08 #4

P: 1
I need to use a command button to open and filter a child of a child form. As a filter it needs to use the PK of the main form and the PK of the first child form to filter and open the child of the child form. Both PK's are referenced in the query the the 1st child form is based on.

Basically, I just need to know if the filter "[PK]=" & me.<PK> can be modified to include two fields instead of one. Any ideas?
Oct 15 '08 #5

P: 53
hi,

you can filter a form on any number of criteria you choose as long as they exist within the recordsource, or within a Foreign Key Constraint.


Expand|Select|Wrap|Line Numbers
  1. "[PK]=" & me.(mainform)PK & "AND" & "[secondKey]=" & me.subfrm!secondKey

hope this helps

Leon
Oct 16 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.