Listbox Displays data associated with parent form?

woodman650

Always confused.
Local time
Today, 12:25
Joined
Jan 22, 2005
Messages
55
Hey guys,
I was wondering... is there a way to have a listbox display values associated with a parent form ID? in other words... say I have a customer with invoices associated with their name, I want to display a form for that customer with a listbox (or maybe even subform) containing the invoice IDs associated with their name.
Right now, I've got:
Code:
SELECT qryClientData.InvoiceID, qryClientData.InvoiceDate FROM qryClientData ORDER BY [InvoiceDate];
to display information in the listbox. How do I modify this to display ONLY Invoices associated with the Clientname on the parent form?

I hope this makes sense. I can clarify if need be, I am just completely stumped. thanks and happy holidays!
 
SELECT qryClientData.InvoiceID, qryClientData.InvoiceDate FROM qryClientData WHERE qryClientData.ClientName = [Forms]![FormNameHere]![FieldWithNameHere] ORDER BY [InvoiceDate];
 
oh, that works perfectly Road Warrior! thanks!

One quick question... this works on a standalone form, but what if the form is a SubForm in a parent form called "MainForm"? Right now I get the error "Enter Parameter Value - [Forms]![frmSummary]![ClientName]"
 
Doesn't matter since ou are referencing the form in a query. As long as the form is open it will work. Is ClientName the control source of the control you are referencing? You need to use the name of the control not the source.
 
hmm, I've got it all set up properly... but I still get the error. It works fine when the form is open by itself, but as a subform, I get the error.
 
hmm, arg. still getting an error. How do I reference a listbox on a main form from a sub form?

Forms![frmMain]![lstList]

Is that right? I am still getting errors.
 
I am trying this and getting an error "Characters found after the end of SQL statement"

SELECT qryClientData.InvoiceID, qryClientData.InvoiceDate FROM qryClientData WHERE qryClientData.ClientName=Forms![frmMain]![lstList] ORDER BY [InvoiceDate];
 

Users who are viewing this thread

Back
Top Bottom