List Box - Multi-Select NEED HELP!!

I am stumped and need some assistance - PLEASE. New to List Boxes.
I have created two unbound list boxes on an unbound form to use as criteria 
for a report. Both list boxes (lboxCategory and lboxSupplier) have two fields 
CategoryID and Category and SupplierID and Supplier sorting ascending on 
latter fields.  The Multi-Select property is set to Extended.  I have a 
command button cmdPreview that I would like to use to preview the report 
after selections are made.  I will select two or more choices from each list 
box at a time.  Can anyone get me started with the code I need to make this 
happen?  I did see some examples using one list box, but how to do with two 
or more list boxes is unclear.

Thank You
0
Utf
11/3/2007 4:01:02 AM
access.formscoding 7493 articles. 0 followers. Follow

1 Replies
863 Views

Similar Articles

[PageSpeed] 32

=?Utf-8?B?aGRmaXhpdHVw?= <hdfixitup@discussions.microsoft.com> wrote
in news:FED0054E-D102-421E-9011-1CAB50120A62@microsoft.com: 

> I am stumped and need some assistance - PLEASE. New to List Boxes.
> I have created two unbound list boxes on an unbound form to use as
> criteria for a report. Both list boxes (lboxCategory and
> lboxSupplier) have two fields CategoryID and Category and
> SupplierID and Supplier sorting ascending on latter fields.  The
> Multi-Select property is set to Extended.  I have a command button
> cmdPreview that I would like to use to preview the report after
> selections are made.  I will select two or more choices from each
> list box at a time.  Can anyone get me started with the code I
> need to make this happen?  I did see some examples using one list
> box, but how to do with two or more list boxes is unclear.
> 
> Thank You
> 
First you need to calculate the filter for the first field per the 
listbox code and store to a variable.

Then you calculate the filter for the second to another variable.

After that, you concatenate the two variables and pass the result to 
the docmd.openreport, using the optional WhereClause parameter

stFilter1 = "[CategoryID] IN (1,2,7,23)"
stFilter2 = "[SupplierID] IN (77,88)"

if len(stFilter1) > 0 AND len(stFilter2) > 0 then
  stWhereClause = Stfilter1 & " AND " & stFilter2 .
elseif len(stFilter1) > 0 then
  stWhereClause = Stfilter1
elseif len(stFilter2) > 0 then
  stWhereClause = Stfilter2
else
 ' no filter ????
end if


-- 
Bob Quintal

PA is y I've altered my email address.

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Bob
11/3/2007 10:20:50 AM
Reply:

Similar Artilces:

Need help to read Pie Chart Series Range
Excel 2003, I have an existing Pie Chart and want to extract the Ranges (cells) used. My code below returns with a "Type mismatch" error. Sub GetPieChartSeries() Dim mySeries As Series ActiveSheet.ChartObjects(1).Activate Set mySeries = ActiveChart.SeriesCollection(1) Debug.Print mySeries.XValues (errors here) Debug.Print mySeries.Values End Sub Thanks, - Pat ...

multi validation?
Is there a way to have a cell validate the following parameters: 1. Ignore blanks 2. Date greater than 1/1/07 3. "NR" value is acceptable So far I can only do 1 & 2 Check your other post. ADK wrote: > > Is there a way to have a cell validate the following parameters: > > 1. Ignore blanks > 2. Date greater than 1/1/07 > 3. "NR" value is acceptable > > So far I can only do 1 & 2 -- Dave Peterson > Is there a way to have a cell validate the following parameters: > > 1. Ignore blanks > 2. Date greater than 1/1/07 > 3....

need Help for Migration Exchange 5.5
Hello NG, we`ve the following Configuration : - Exchange 5.5 with SP4 - single Winwos 2000 DC - configured both side ADC a new Hardware should be used for an Exchange 2003 and second DC. next steps i would do as following : - Update ADC Version with Exchange 2003 ADC - running Exchange 2003 forestprep, then domainprep, an after all running setup to install Exchange 2003 in the same organization, site - replicate system Folders and public Folders - moving all Mailboxes to the Exchange 2003 Store - configure the Exchange 2003 virtual SMTP Server to send outgoing Mail - reconfigure the F...

Msg Box question
I have several reports that are run by queries. Most of these queries have date range parameters that must be entered by the operator. I have one query that I ask only for a week ending date. This is driving mgmt nuts because they are used to entering a beginning date first, followed by the ending date. I hard wire the beginning date myself. How can I get a msg box to pop up to tell people what my hardwired date is? Ideas? I believe you're describing pop-up Parameter Input Boxes, not message boxes. One option is to use a form to enter the parameter values rather than simply h...

Word Doc Macro help needed please!
I need to make a mocro that will work in a word doc. This macro would start with [000001] and count up one number each paragraph. For example paragraph two would auto show [000002] and so on. Any help would be GREAT! I have a word file which contains 100 pages. All the pages have name & address of companies.(not in table) i have to transfer them to excel in column format(for example first name, last name, address, phone etc) can any one tell me code for this( i know how to open word & creat new excel sheet) . I need code for how to reach to lines of word. r there any thing like &quo...

Do I need a licence to distribute MSFLXGRD.OCX?
I wish to use the MS FlexGrid control in my Access database. Do I need a licence to distribute MSFLXGRD.OCX? Pual Paul H wrote: > I wish to use the MS FlexGrid control in my Access database. > > Do I need a licence to distribute MSFLXGRD.OCX? If you also use a VB application, the answer is no. But you will need to build and deploy a VB application to distribute and register the OCX. You cannot distribute it with an Office application alone. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Arvin Meyer [MVP]"...

Combo Box List Content Control
I want both the code and corresponding English translation to appear in the dropdown box. The codes are in col A, and the translations are in col B. Under Properites, ListFillRange I have entered: Jobs!A2:B200. Only column A is shown in the dropdown box. Also, when I select one of the dropdown options I get a VB error with my "Jobs!A2:B200" displayed in the VB code. Please tell me what I'm doing wrong. Thanks. Did you change the columncount property to 2? Be aware that the both columns will appear when you click on the dropdown arrow, but only one value will appear in ...

How to Exclude Account from Budget when Option Check Box is Inactive?
I want to exclude the income in my retirement accounts from being included in the budget planning and being shown as income in monthly reports. In the account details, the option is "checked" to include in budget planner but the lined is grayed out and in-active and thus I can't uncheck it. How to uncheck? ...

Printing changes layout
I am printing a booklet on Pub 2002 - when I print one page, it prints a page where everything has changed - resized, cut off the edges, etc. The worst part - when done printing, it goes back to normal view and it actually changes my layout to match what is printed - permanently. Any ideas what is going on? I printed on both my Lexmark and HP printers, does the same thing. I have Windows XP. Help! Thanks! Look at your page layout, has it changed? I know this will happen to me occasionally when I change printers. If I change back to the original printer the publication will revert...

global address lists, and or distribution lists
Was wondering if it is possible to create a distribution list that can function similarly to a global address list. The stated purpose of a distribution list is to be able to coordinate a mass email to a set a pre-selected individuals. I want to know if it's possible to have a list, separate from those individuals already listed in the global address book, so that you can access a certain individual, or a group of people from within the list, and email them separately, not as one joint email. If this is possible, I was wondering about how to set it up in microsoft outlook 2002...

Select last value
I am trying to select the last (bottom) value on a one-column list. I am using the COUNT function to designate the bottom value that is not zero, and the CHOOSE function to select the designated value. But, I can't make that work. Help appreciated. try =match(a number larger than possible,your range) -- Don Guillett SalesAid Software donaldb@281.com "Carl" <c@invalid.com> wrote in message news:eciLEKsvFHA.3236@TK2MSFTNGP14.phx.gbl... > I am trying to select the last (bottom) value on a one-column list. I am > using the COUNT function to designate the bottom va...

How do I get a filter to "UPDATE" the rows selected?
Hey there! I am using Excel 2002 and I have a speadsheet that has prices in it. If I have the filter set to (the filter criteria is much more complex than this though) prices for items that cost >$5.00. Of I change an item to 4.59, it should not be seen. How can I get it to re-update the rows shown, with out releaseing the filter and resetting it? Is there something like refresh.filter or anything like that? Thanks Phil AFAIK you must release and reset but a macro with a worksheet_change event could trigger this for you so that it would happen automatically. -- Don Guillett SalesAid...

Help With Sorting #3
Gudday to all XL gurus. I need some help on using the SORT function. I have a list of 100 competitors in a scoring spreadsheet that I hav written. I was trying to sort by surname (a-z). The problem is that this list i generated elsewhere and contains VLOOKUP functions. Obviously if i hav less than 100 competitors I end up with some cells appear blank bu contain VLOOKUP functions. XL sorts them first and I want them sorte last after the surnames (a-z). I cant add a helper column as this lis relates to over 48,000 forumulaes and functions that are already added If I add a helper column I have...

List Boxes #2
Can someone tell me how to correct the following code so that both columns in the listbox will be updated? Only the first column distplays Dim MyArray() ReDim MyArray(mycount, 1) usrGLDist.lstOutput.ColumnCount = 2 For i = 0 To rst.Count - 1 MyArray(i, 0) = rst.Value("descr") MyArray(i, 1) = rst.Value("pcamt") rst.MoveNext Next i 'Load ListBox1 usrGLDist.lstOutput.List() = MyArray Richard wrote : > Can someone tell me how to correct the following code so that both > columns in the listbox will be updated? Only the first col...

How to make a pop up combo box like calendar pop up
I have a form with a series of text boxes for entering order information. But because i want to be able to select more than one entry from a combo box, I thought it would be nice to have each item added to a text box and for neatness and ease of programmability, I'd like it if a combo box would pop up beside the text box much like the date picker pops up when entering a date field. Then each item selected could get appended to what's already in the text box. So my questions are: Does such a thing already exist and i can just download it and add it to my database? ...

Need help converting Microsoft Outlook calendar to Entourage.... At wits' end here! Please advise...
I have a Mac at work which runs Microsoft Outlook 2001 client on an Exchange server. I have a calendar on this machine (stored locally, not on the server) which has a ton of reminders programmed into it - very useful! Now, at home I got a new Mac laptop with Entourage X. Is there any way to move all of the reminders (appointments) from my calendar on Outlook to my Entourage calendar? I've tried two things: 1) I exported the calendar info as a CSV text file, and then tried importing it in Entourage. The problem is that Entourage import function seems to think it's importing an Address...

I need a list of command line switches for Microsoft WORD.
I am using a Shell command to execute Microsoft WORD 2003. I need to halt execution of VBA code until WORD finishes it's task. Is there a command line switch for WORD to cause it to pause the VBA function until it is finished? Is there a VBA command to pause execution of code until WORD finishes? Thanks. I am pretty sure the answer to your specific question is "No". If you tell us exactly what you are doing, including from where the Shell command is being executed, maybe we can suggest another way that will overcome the problem. -- Hope this helps. Please r...

CtreeCtrl multiple selection
Hi, Is there any simple way (samples) to set a CTreeCtrl has multiple selection feature? Thanks, Chi Try these: http://www.techsoft.no/bendik/ http://www.codeguru.com/Cpp/controls/treeview/misc-advanced/article.php/c723 http://www.codeguru.com/Cpp/controls/treeview/misc-advanced/article.php/c629 -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Chi" <anonymous@discussions.microsoft.com> wrote in message news:21bd01c4aa63$2e355d70$a501280a@phx.gbl... > Hi, > > Is there any simple way (samples) to set a CTreeCtrl has > multiple selection feature? Thanks, > &...

help with lookup formula (sheet 2, not a double post)
I need to make a formula using a lookup. The first spreadsheet is a inventory (ALO INVENTORY JP). The second (P&G 103) is a chart tha tells number of gallons of alcohol per foot/inch/fraction. On ALO INVENTORY JP I insert the # of feet, inches, and the fraction i cells R5 and T5. I want these numbers to lookup the number of gallon off of the P&G 103 worksheet. For example: P&G 103 (on inventory sheet) is 26ft 4 1/2 inches, i should look-up to be 34572 gal. for the 26'4" and 55 gal. for the 1/2" These two numbers should be added together and multiplied by the numbe ...

Help!! Way to find users sending email to large amount of receipients.
Could some one tell me if there is a way in Exchange 2003 to find out what users are sending email to a large amount of recipients? I'm having some serious performance issues and I'm sure it's some one sending email to a large amount of recipients. Thanks, Will ...

Help #15
I have a problem. I have a list of numbers that are in one column. Alot of numbers 8000 or so, and I need to find if there are an duplicates. I sort them so that they are in order, but having t scroll through the whole list takes alot of time and hurts my eyes!! I tried advanced filter but I can only find how to find duplicates in different columns. Someone help me please! ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step...

Help with displaying the contents of the last populate cell.
I have numerous sheets within a book where all cells in column C in all sheets have the following formula “=IF(ISBLANK(P4),"",(R3-P4))”. For you reference both columns P and R hold a monetary value and are formatted as Currency. Is there a way that cell D1 can automatically be populated with the contents of the last cell in column C that has a value in it. E.G. Sheet 1, cell C19 has a value of 200, therefore cell D1 should be 200. Sheet 2, cell C25 has a value of 250, therefore cell D1 should be 250. Sheet 3, cell C99 has a value of 900, therefore cell D1 should be 900. Any h...

Outlook 2003 Adding several Emails to Block Sender list at One Tim
I just upgraded to Windows 2003 SP 2. In the older version of Outlook, I could highlight several emails and add them to the junk senders list by selecting: Action/Junk Email/Ad to junk senders list With 2003, the option to “Add Sender to blocked senders list” is grayed out and I am not able to select it. What can I do to be able to use this? It is available when I select an individual email. ...

Help on filter
HI, I have a list to filter. I have to keep only integers. I tried everything in advanced filters... does not work. Can you help me please? Thanks Sylvai -- Message posted from http://www.ExcelForum.com Hi one way: use a helper column. Lets say your numbers are in column A then enter the following formula in an adjacent cell for row 2 =IF(MOD(A1,1)=0,"X","") copy this down for all rows. After this filter with this helper column -- Regards Frank Kabel Frankfurt, Germany > HI, > I have a list to filter. I have to keep only integers. > I tried everything in ...

help!
Hi I have been given a dataset with data,but the problem is now i need to create membership cards,which i plan to use the label wizard in reports,but i also have to display the intials of the customer but i have not been given the fields for intials just forename and last name.Is there maybe a way of running a query to search for some of the forename field to use as my intial???? thanks ! I thought I had seen this post a day or two ago and it was answered. If you want Initial and Last name Left(FirstName,1) & " " & LastName -- Dave Hargis, Microsoft Access MVP &qu...