Using a list box to run a query

djphillips1408

New member
Local time
Today, 10:35
Joined
Sep 18, 2008
Messages
5
OK first go here and access newbie so excuse my ignorance in advance :)

I have a form which has list box of student groups, the subform on the page then should list the students depending on the group clicked on the list box. So if you select group 1 from list box then students appears in the subform and if you select group 2 diferent students appear. I have the query made with parameter akin to[Forms]![overall]![group] to grab the group details and drop them into the query which I used to make the subform.

What I can't do is to get the subform to update on screen when the group is selected from the list box, well when I say update - just displaying the students would be nice first then update if you click a different group on the list box.

I really appreciate any advice you can give as this is all new to me.
 
BTW if this does not make sense then let me know and will reword it. Happy to email someone with mdb file if they think they can help too.

David
 
Why dont try something like this

On click event of the list box put

Forms!MyForm!MySubForm.Form.RecordSource = Your Query
Me.Form.Recalc

I can explain a bit more if it fails to get you started
 
Thanks for getting back to me and I can see what your code is trying to do but I can't get it to work. The form is called "overall" and the sub form "frm_student" with a query named "qry_student"

I know I am being ignorant in this forum but this is all brand spanking new to me, so please be patient.

With the code you gave me I am a little confused as why 2 lines - I can't assign 2 separate lines of code to the "onclick" event AFAICS. Should there be a character after "Your Query" such as an . or a !
 
ah I get it needs to go in the VB editor.

Still does not work though

I am using

Forms!Overall!frm_student.Form.RecordSource = qry_student
Me.Form.Recalc

Does do something though as when I select group from list box then Name# gets fired back in every box on the subform. SO I see this as progress and am grateful still
 

Users who are viewing this thread

Back
Top Bottom