multi select list box won't return records

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

Will a multi-select list box display records when it is a control on a
subform?

I have a multi-select list box called lstBidSelect, in which the row source
is: SELECT Bid.BidNumber, Bid.BidType, Bid.BidStatus FROM qryBid WHERE (((Bid.
ProjectID)=Forms!frmMainScreen!cboProjectName)) ORDER BY BidNumber;

When I place lstBidSelect on a subform that exists on frmMainScreen or if I
place it on another form called frmEstimateSelector and inserted that as a
subform of frmMainScreen, it doesn't display any records. HOWEVER...If I
open frmEstimateSelector via command button, it displays the proper records
related to "frmMainScreen!cboProjectName".

When I placed frmEstimateSelector as a subform, I linked the proper fields
necessary to relate the records properly. I have other subforms that work
properly, so I am ruling out any "linking" issues.

Is there possibly another setting or event required, or is it a normal
limitation of Access that a multi-select list box will not return the records
in, as, or part of a subform?
Thanks in advance for any suggestions!
Slez
 
D

Douglas J. Steele

For some reason, Subforms actually get instantiated before their parent form
is instantiated, so it's possible that when lstBidSelect is being populated,
Forms!frmMainScreen!cboProjectName doesn't have a value.

Try refreshing the listbox. To see whether this works, you can go to the
Immediate window (Ctrl-G), type the following into the box:

Forms!frmMainScreen!NameOfSubformControl.Form!lstBidSelect.Requery

and hit Enter. (Make sure you're using the name of the control on
frmMainScreen that contains the subform: depending on how you added the
subform to frmMainScreen, the name of the control may not be the same as the
name of the form being used as a subform)

If that solves the problem, then try putting that line of code in the
Current event of frmMainScreen.
 
S

Slez via AccessMonster.com

That worked perfectly! Thanks for the help!
Slez
For some reason, Subforms actually get instantiated before their parent form
is instantiated, so it's possible that when lstBidSelect is being populated,
Forms!frmMainScreen!cboProjectName doesn't have a value.

Try refreshing the listbox. To see whether this works, you can go to the
Immediate window (Ctrl-G), type the following into the box:

Forms!frmMainScreen!NameOfSubformControl.Form!lstBidSelect.Requery

and hit Enter. (Make sure you're using the name of the control on
frmMainScreen that contains the subform: depending on how you added the
subform to frmMainScreen, the name of the control may not be the same as the
name of the form being used as a subform)

If that solves the problem, then try putting that line of code in the
Current event of frmMainScreen.
Will a multi-select list box display records when it is a control on a
subform?
[quoted text clipped - 23 lines]
Thanks in advance for any suggestions!
Slez
 

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