Access Use Continuous Form as Listbox

Continuous SubForm ListBox

(OP)

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?

RE: Continuous SubForm ListBox

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

subform.listbox.requery

it should work

RE: Continuous SubForm ListBox

(OP)

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:

Any other ideas?

Cheers for the quick reply.

RE: Continuous SubForm ListBox

what is the query on that listbox did you put a criteria to show you only fields that matches the mainform?

RE: Continuous SubForm ListBox

(OP)

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?!)

RE: Continuous SubForm ListBox

and when the open the form and you what dose the list box or query show you ?

RE: Continuous SubForm ListBox

(OP)

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...

RE: Continuous SubForm ListBox

How are ya hedidit  . . .

in the On Current event of the subform:

CODE

   Me!ListboxName.RowSource = Me!ListboxName.RowSource

See Ya! .  .  .  .  .  .

RE: Continuous SubForm ListBox

how do you guys enter the code in this forum to show in a code box

RE: Continuous SubForm ListBox

Group by [REPORTS:All_Q&Ab].QID
having ((([REPORTS:All_Q&Ab].QID)=[Forms]![SurveyIN]![a].[Form]![QID]));

RE: Continuous SubForm ListBox

show in a code box
To display this:

Type this:
[code]my code here[/code]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

RE: Continuous SubForm ListBox

thanks

<code>phv thats cool </code>

RE: Continuous SubForm ListBox

nopes

RE: Continuous SubForm ListBox

Why using angle brackets ? Reread carefully my previous post.

RE: Continuous SubForm ListBox

RE: Continuous SubForm ListBox

i got it this time thnkx

should i give u a star?

RE: Continuous SubForm ListBox

Quote (IGPCS):

. . . how do you guys enter the code in this forum to show in a code box . . .

Have a look at TGML MarkUp Language

See Ya! .  .  .  .  .  .

RE: Continuous SubForm ListBox

(OP)

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

RE: Continuous SubForm ListBox

hedidit . . .

Are you saying the listbox is in the detail section?

See Ya! .  .  .  .  .  .

RE: Continuous SubForm ListBox

(OP)

yep of the subform...

RE: Continuous SubForm ListBox

(OP)

actually i just found a previous post i made that you replied to but that, for some reason, doesn't work?

I tried putting:

CODE

[a].Form!Combo6.Requery

Where [a] is the subform of my main form and combo6 is the list box name.  I've put this code in the afterupdate event of the main form... any ideas?  Thanks for your help

RE: Continuous SubForm ListBox

hedidit  . . .

Sorry to get back so late . . .

A listbox in the detail section is a bad idea! Realize its a single listbox object and can't display a seperate RowSource for each record. So when you update the listbox they'll all show the the results of the same RowSource!.

You need to move the listbox to forms header or footer section. then try the code again . . .

See Ya! .  .  .  .  .  .

ritchierile1996.blogspot.com

Source: https://www.tek-tips.com/viewthread.cfm?qid=1295797

0 Response to "Access Use Continuous Form as Listbox"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel