How to display query information in a listbox on a subform

  • Thread starter Thread starter jhanby1
  • Start date Start date
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?????
 
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).
 
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]));
 
Ok, I'm officially a novice coder. All I had to do was add Me.Refresh
to the subform OnCurrent event.
 
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.
 
Back
Top