How to display query information in a listbox on a subform

J

jhanby1

Ok, so I have the correct query information entered as the row source
for the listbox. It runs correctly when I open the query by itself, and
runs correctly when I open the subform itself, but when I open the main
form where the subform is located, the list box doesn't display any
information from the query. It shows the column heads, but thats it.
Also, when I have the main form open to a particular record that I want
to display information from the query for, the query works when I open
the query by itself, but still won't show in the main form. The listbox
settings appear to be correct (# of columns, column width, etc) so its
not hiding any of the information. Any ideas?????
 
J

jhanby1

The following query is the Row Source of the listbox
(qselCaseAttorneys)

SELECT DISTINCTROW tblParties.LawyerID, tblParties.PartyName,
tblParties.Category
FROM tblParties
WHERE
(((tblParties.tblCasesID)=Forms!frmMainPage2!fsubCaseDetails!tblCasesID));

The query should be correct b/c it runs just fine outside of the main
form (so the referencing is correct).
 
J

jhanby1

I think it may have something to do with the record source for the
subform, but I can't figure out what it is.

Record Source for fsubAttorneys = qselAttorneys

SELECT tblParties.tblCasesID
FROM tblParties
WHERE
((tblParties.tblCasesID)=[Forms]![frmMainPage2]![fsubCaseDetails]![tblCasesID]));
 
J

jhanby1

Ok, I'm officially a novice coder. All I had to do was add Me.Refresh
to the subform OnCurrent event.
 
R

Rob Oldfield

Ok, I'm officially a novice coder. All I had to do was add Me.Refresh
to the subform OnCurrent event.

aaah... the wonders of using a refresh. (A requery is quite often the
answer as well)

Well done.
 

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

Similar Threads

cbo on subform 3
Passing a value from subform or main form to subform query 4
Subform Blank? 3
Access Cannot select items in listbox 1
Subform Recordsource 1
subform question 2
subform total behaving strangely 2
changing query 1

Top