multiple select listbox..

keybearer

Registered User.
Local time
Today, 21:38
Joined
Jul 7, 2003
Messages
41
hi.. need some help here.. again..
i have a report that will display the addresses of my contacts just like in the northwind database.. but i want to be able to select the addresses that i want to be sent to the report.. i know that i have to use a listbox and set it to multiple select enabled.. but how do i send the values to the report?
 
My example here should be what you're looking for.

IMO
 
hi IMO.. i have a problem with your example.. lets say that i have transferred the wanted ID's/Names to the textbox separated by a comma.. LMH 004, N 005 e.g.. how do i open the report where the addresses are the people whom their ID's is in the textbox?
 
keybearer,

IMO's form builds a query called "qryMultiSelect". In the
code you will have to change the table name and the name of
your primary key.

Look at the query after you run the code.

IMO, that's a nice example!

Wayne
 
yes.. i know about the qryMultiSelect query.. i've changed the table and the source.. but the report still displays all of the addresses... :(
 
If you post your DB I'll take a look

IMO
 
my database is quite big.. ill try to shrink it and post 2morrow.. anyways.. i kept on getting this error..

compile error:

user-defined type not defined

and it highlights this line of code"

Code:
Dim loqd As QueryDef
 
You are missing the 'Microsoft DAO 3.6 Object Library'. Open any form in Design view,goto View >>> Code, goto Tools >>> References and select it from the list.

IMO
 
Last edited:
hmm.. thanks.. that's solved.. now i have a new problem..
theres a

run-time error '3075
syntax error (missing operator) in query expression 'MbrShp IN (A 005, LMH 012)'.

when i looked at the code.. it stopped at loqd.SQL. the pop up is too long and i cant read where im making a mistake..

im getting a headache here..:(
 
Your ID field needs to be Numeric. Add an Autonumber field to your table and call it 'QID'. Now change this line of code to...
Code:
    stSQL = stSQL & "FROM qryYourQuery WHERE QID"

IMO
 
hi again.. sorry for the late reply.. this is my database after i did some shrinking..
i think where i'm doing wrong is in the queries.. any help on that will be helpful..
if possible, i need the confirm button to just send the values to the textbox and the preview button to open previewed report..
please help..
 

Attachments

keybearer,

IMO's code works great, you just needed to put single-quotes
around each element. See the query.

I got rid of all of the Trim function calls.

Wayne
 
err... wayne.. the queries work fine, but the report still displays all of the records.. i just need the selected names..
 
keybearer,

oops, I didn't notice that.

That's because your report uses the MailingLabelQuery instead
of the MultiSelectQuery that the form produces.

Wayne
 
so wayne, what's your suggestion? the data needs to be taken from the MailingLabelQuery.. or is the multiselectQry needs to be changed? if so, can you help me?
 
Last edited:
keybearer,

The form makes the MultiSelectQry, so that should be the data
source for the report.

Just get the FullMailingLabel report in design mode and change
the query name.

Wayne
 
hey wayne, thanks.. just finished changing the sources and it works!!!!! thanks a lot..
 

Users who are viewing this thread

Back
Top Bottom