Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continuous SubForm ListBox 1

Status
Not open for further replies.

hedidit

Technical User
Jul 21, 2005
142
GB
Hi all,

I have a form with a subform. The subform lists all records associated with the main form.

The continuous subform has a list box that lists records from a table based upon a value in each subform record BUT the content of the list box isn't updating for each subform record... usually i'd look into using requery on the onload event but think this is for reports only?

Can anyone help me out with this?

Cheers in advance?
 
type in the after upadte or the on current of the main form
in the code builder

subform.listbox.requery

it should work
 
Hi IGPCS, tried that and it's telling me that it doesn't recognise the name of the combobox on the subform.

I'm 100% sure I've got the name of the form and the combobox correct in my code, i wrote it as:

Code:
a.combo6.requery

Any other ideas?

Cheers for the quick reply.
 
what is the query on that listbox did you put a criteria to show you only fields that matches the mainform?
 
The query / row source for the listbox is:

Code:
SELECT [REPORTS:All_Q&Ab].AID, [REPORTS:All_Q&Ab].Answer
FROM [REPORTS:All_Q&Ab]
WHERE ((([REPORTS:All_Q&Ab].QID)=[Forms]![SurveyIN]![a].[Form]![QID]));

(Doesn't access just write the nicest looking SQL?!)

 
and when the open the form and you what dose the list box or query show you ?
 
When I open the form it shows the listbox repeated form each record on the continuous form which is correct but it shows the same values for each record BUT it should only show records relating to the [QID] field on the subform...

 
How are ya hedidit . . .

in the On Current event of the subform:
Code:
[blue]   Me![blue]ListboxName[/blue].RowSource = Me![blue]ListboxName[/blue].RowSource[/blue]

Calvin.gif
See Ya! . . . . . .
 
how do you guys enter the code in this forum to show in a code box
 
Group by [REPORTS:All_Q&Ab].QID
having ((([REPORTS:All_Q&Ab].QID)=[Forms]![SurveyIN]![a].[Form]![QID]));
 
show in a code box
To display this:
Code:
my code here
Type this:
[ignore]
Code:
my code here
[/ignore]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Why using angle brackets ? Reread carefully my previous post.
 
Hey TheAceMan1,

I'm good cheers how are you?

Anyway the code you suggested worked in that the list boxes now show the correct values in the list however only the list box on the first record of the continuous form shows the value selected by the user after the the form has been closed and then reopened.

I checked in the relevant table and found that the values selected in the list boxes on the continuous form records are being stored they're just not showing up as being selected after the form is clsoed and then reopened...

Does that make sense?

Cheers

 
hedidit . . .

Are you saying the listbox is in the [blue]detail section?[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top