Unbound listbox

H

Harmannus

Hallo,

I have a mainform with a subform that has a unbound listbox on it.

But...

How can i limit the records shown in the unbound listbox to the selected
record of the main form.

So.

I have lets say 10 projects. On the main Projectform (frmProject) i select
projectnumber 12345. The subform (fsubProjectdata) shows 5 corresponding
records. The unbound listbox on the subform shows all records. How can i
limit the data in the unbound listbox to the 5 corresponding records of the
projectnumber selected on the mainform?

The unbound listbox shows the records of all my projects.
SELECT ProjectID, Projectdate FROM tblProjectData;

Thanx for any tips!

Regards,

Harmannus
 
S

Steve Schapel

Harmannus,

If I understand you correctly, you need to have the Row Source of the
Listbox set to something like...
SELECT ProjectID, Projectdate FROM tblProjectData
WHERE Projectnumber = Forms![frmProject]![Projectnumber]

- Steve Schapel, Microsoft Access MVP
 
H

Harmannus

Hallo,

Exactly!

Selecting the record on the main form shows the correct data in the subform
listbox bount to the below query:

SELECT Vergaderdata.VDID, tblVergaderdata.Vergaderdatum, tblVergaderdata.VID
FROM tblVergaderdata
WHERE (((tblVergaderdata.VID)=[Forms]![frmVergadering]![VID]));

But selecting the next record on the main form doesn't update the listbox...

Any suggestions how to correct this?


Regards,

harmannus



Steve Schapel said:
Harmannus,

If I understand you correctly, you need to have the Row Source of the
Listbox set to something like...
SELECT ProjectID, Projectdate FROM tblProjectData
WHERE Projectnumber = Forms![frmProject]![Projectnumber]

- Steve Schapel, Microsoft Access MVP


Hallo,

I have a mainform with a subform that has a unbound listbox on it.

But...

How can i limit the records shown in the unbound listbox to the selected
record of the main form.

So.

I have lets say 10 projects. On the main Projectform (frmProject) i select
projectnumber 12345. The subform (fsubProjectdata) shows 5 corresponding
records. The unbound listbox on the subform shows all records. How can i
limit the data in the unbound listbox to the 5 corresponding records of the
projectnumber selected on the mainform?

The unbound listbox shows the records of all my projects.
SELECT ProjectID, Projectdate FROM tblProjectData;

Thanx for any tips!

Regards,

Harmannus
 
S

Steve Schapel

Harmannus,

Try this... On the On Current event of the main form, put code the
equivalent of:
Me.NameOfSubform.Form!NameOfListbox.Requery

- Steve Schapel, Microsoft Access MVP
 
H

Harmannus

Hallo Steve,

Thanx a lot! Combined with your previous sugestion the below code did the
trick ;-)

Happy newyear!


Regards,

Harmannus




Steve Schapel said:
Harmannus,

Try this... On the On Current event of the main form, put code the
equivalent of:
Me.NameOfSubform.Form!NameOfListbox.Requery

- Steve Schapel, Microsoft Access MVP


Hallo,

Exactly!

Selecting the record on the main form shows the correct data in the subform
listbox bount to the below query:

SELECT Vergaderdata.VDID, tblVergaderdata.Vergaderdatum, tblVergaderdata.VID
FROM tblVergaderdata
WHERE (((tblVergaderdata.VID)=[Forms]![frmVergadering]![VID]));

But selecting the next record on the main form doesn't update the listbox...

Any suggestions how to correct this?


Regards,

harmannus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top