Full Version: combobox selection to affect form display records
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
fullyunknown
is it possible to do the following...

i have a form that has many items on it. for example: name, location, age, etc...
then if i was to hit the next button it would bring up a new name and thier location, age, etc..

well lets say I assign the students to schools.

I want to be able to have a drop down box that i select the school and now as i hit next or add anything to the records- it only displays/affects those that belong to that school.

i have setup a relationship between schoolID in the table schools and school in the table students .

is there anyway to do what i am asking? tried a few things but i am not knowledgable enough to completely figure it out..

thanks
theDBguy
One way to implement this is by using a form/subform setup.

The main form refers to the School table, and the subform refers to the Students table. You will link both forms using the SchoolID field.

Hope that helps...
fullyunknown
i was trying that but i dont think i am doing it right...

setup main form for schoolid and school name

then subform i put the form which i want to display all the information relating to the student/s that belong to that school.

but all i get it to do is show me records for all the students and clicking on the combobox drop down menu doesnt filter anything for me..
theDBguy
Maybe you have not set up the Link Master/Child Fields properly. Go to the properties window of the subform control on your main form and look for the properties: Link Master Fields and Link Child Fields. Then select SchoolID from the dropdown for both of them.

Hope that helps...
fullyunknown
ok, i have attached a very striped version of my database. i am trying
to see what exactly i am doing worng. when i select a base/state it
doesnt seem to change the records it is looking at..

you will get a lot of errorss when you open the main, thats only cause i
have not included other tables that some of the stuff in the form calls
for...

(well nevermind, the site wont let me upload it) - i got it all setup now, just cant figure out the code i should use for row source on my sub...(for example, i can click a base and i see it say loading now and trying to change but my rwsourse code for the sub has to be way wrong..



the 2 tables i have are: bases, baseinformation
two forms: mainBaseInfo, subBaseinfo


baseinformations table is setup with a relationship to table base.. so it would be base.baseID and baseinformation.base
baseinformation.base would have a 1 which if you looked in base table under baseID it would go with1=florida
theDBguy
You can email it to me. Make sure it's zipped. My email address is in my profile. Good luck.
fullyunknown
k, i sent to you.... thanks again

and when you look at it and fix whatever dumb i was doing, could you post here please? i probally be at work and cant check personal email there....

Edited by: fullyunknown on Tue May 13 20:46:39 EDT 2008.
theDBguy
Wouldn't you know it. I got the email, but when I tried to open the attachment, I got the:

"Unrecognized database format..." error

Would you like to try again? What version of Access are you using?
fullyunknown
i sent it to from my work email, thanks
fullyunknown
You dont need to look at it now, I thank you for all your help.. I finally figured out what I did wrong. Looking at an example I read what goes in the Link child fields wrong; finally fixed... :-)
theDBguy
OK. Glad to hear you got it fixed as I couldn't get to my email until tonight. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.