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

How to popupate a subform based on a field selection

P: 8
Hi,

I'm trying to create an "overview" form. And I haven't been able to figure out how to get Access to do what I want yet.
Basicly what I want, is to populate a subform based on a field selection. In other words, I have several fields like colour, shape, location etc. on my Main form. Now I want to add a subform to my unbound mainform, showing what I have in a table, depending on what is selected in the fields.
So if I choose red, triangles from Warehouse 2 I'd like to show all the different products in my table that would match this criteria in my subform.

But how do I go about it? Do I create a field on my mainform and change the value depending on what I select, and then somehow link my subform to that field or do I make it as some sort of VB code?
I think the big issue is that I want to be able to switch what I show in my subform depending on what is selected on the mainform (I want to show a list of records, not just a single record), and I'm not entirely sure how to write such dynamic syntax... or where...

I hope you can help,

Br, MnMs
May 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: 8
Gah, It seems every time I'm stuck at some problem and need some help I post here and voila - I come up with the solution myself - sorry about this. I found a solution to my problem. I just needed to set the recordsouce dynamicly. Fairly easy really. The example I found states:

On event, add something like this:

Me.Subformname.Form.RecordSource = "SELECT * FROM TableName;"
Me.Subformname.Form.Requery

or just give the name of a query.
Me.Subformname.Form.RecordSource = "queryname"

I did try and figure this out for a couple of days first though - so feel really silly now. I hope someone else can use this post...
May 23 '07 #2

P: 7
Thanks so much. I was trying to figure this out for days! Just wanted to let you know you really helped me so thank you for posting your solution!
May 24 '07 #3

Post your reply

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