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
705 Views

Similar Articles

[PageSpeed] 55

=?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:

Drag and drop on a recycle bin ... a little help needed
Hello all I have implemented the drag and drop code from The Code project http://www.codeproject.com/shell/explorerdragdrop.asp?msg=420048 but it crashes when the files are dropped on the recycle bin. CCmdTarget::~CCmdTarget() { #ifndef _AFX_NO_OLE_SUPPORT if (m_xDispatch.m_vtbl != 0) ((COleDispatchImpl*)&m_xDispatch)->Disconnect(); ASSERT(m_dwRef <= 1); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE #endif #ifdef _AFXDLL m_pModuleState = NULL; #endif } Does anyone have an...

outbox won't send (2nd plea for help)
I can not empty the outbox when I send mail. I can do each one seperately. The problem I belive is the outbox is not included in the send receive group. Outlook 2002 will not allow me to add it either. is there a way to unlock or unblock this??? ...

Customizing Activities\History LIst
Is there a way to add a date to Activities' History list? It would be nice to know when each activity happened. Thanks, Troy Troy, no way currently, although Microsoft has mentioned it might be an option in version 2.0 (nothing is guaranteed!) A few ISVs have custom products that do it... www.salentica.com www.c360.com Dave "Troy" <anonymous@discussions.microsoft.com> wrote in message news:af6b01c436bd$ce671f00$a001280a@phx.gbl... > Is there a way to add a date to Activities' History > list? It would be nice to know when each activity > happened. >...

Distribution List Changes
Hi All, I have a mail enabled distribution list with four users. Only those users plus the Administrator have rights on this group. Yet a seperate user is able to add / edit or remove users to this group even though they do not belong to this group. The user does not even have admin rights and is able to make changes. Let me know of any options I can try. Thanks Waynear wrote: > Hi All, > > I have a mail enabled distribution list with four users. Only those > users plus the Administrator have rights on this group. > > Yet a seperate user is able to add / edit or remov...

Need to decrease decimal places for an active currency ID
We currently have the JPY (Japanese YEN) set at 2 decimal places, but it needs to be set to none. We already have transactions against this currency is several databases (we have over 120 companies in MSD GP 10), so rebuilding is not a good option. Is there any way to force the reduction of decimal places (I'm assuming update MC40200 set DECPLCUR = '0' where CURNCYID = 'JPY'), and what would the consequences be? Thanks! The only way to do this is via SQL, then to perform a checklinks on all Multicurrency table. However, not because you can means you sh...

Sound shows on custom Annimation list yet no sound heard
When the PP Presentation is saved as a show,some slides have sound and some do not. All sound came from the same folder. Also, when playing the slides while in PPPresentation, swome have sound and some do not despite all being indicated on custom annimation lisy and all startin "after previous." Thanks! Often when one sound plays but another doesn't, it's an issue of the length of the file path. What's the file path to your music? Is it really long? If so, the longer-named songs might just be hitting the length limit. -- Echo [MS PPT MVP] http://www.ec...

Control Button help needed
In the microsoft template database "Classroom"/ Classes form there is a command button that will open another form (Students) on a specific record in the subform. I can't figure out how to do this. Can anyone out there help me? The code behind the button is using the OpenForm method and is passing the ID of the record to open to as part of the "WHERE" argument. Look up OpenForm method (or action to see the macro version) and review the arguments. "Obeide115654" <Obeide115654@discussions.microsoft.com> wrote in message news:325A53B7-7553-40F0...

Chart Help
I have a chart with several columns of data that has column A as the X axis and any one of columns B through M can be plotted on a left Y axis and a right Y axis to compare two columns of data at the same time. This chart might have 100 rows of data or 600 rows of data. I figured out how to automatically update this chart with the number of rows of data I have thanks to Jon Peletier's great tips on his website. : ) BUT..... my question is this: I would like to insert a column to figure out the average of the first 3 columns. The only way I know how to do this is to put the formula in the ...

Fixed Assets, Depreciation and the GL help please
Hello, I=92m trying to teach myself the Fixed Asset module of GP. I understand how to setup FA, i.e. creating the account groups, assigning the group to asset classes (to assign posting accounts), putting all the assets into a class that need share the same depreciation methods, creating books, adding assets to books and have the book class match the asset class so the asset picks up the depreciation details of the book class, etc. After that I=92m kind of lost. :) So, at each month end I need run depreciation correct? But running depreciation does not integrate into the GL so I ...

Drop Down List and Check Box
Hi...I was search for this topic but don`t found the solve...Anyway I have a drop down list like this [image: http://www.geocities.com/augurtrade/excel_checkbox.txt] and this [image: http://www.geocities.com/augurtrade/excel_checkbox2.txt] ok my questions is what is (Blanks) and (NonBlanks)...? Is it possible for me to see only all the check box that was checked or vice versa...??? How to make a total below the checkbox i mean when someone check the check box, a total number appear below the last check box [image: http://www.geocities.com/augurtrade/excel_checkbox3.txt] [image: http://www.g...

how reliable is the "Who has you in their contact list" list?
Because someone who I think has recently (within the last week) deleted me is still on this list (I don't think she blocked me), but when I check who deleted me on blockstatus.com, he shows up. could it be it's not updated? which of the two would be more reliable? -- maykk Greetings, Do not use these websites, they will steal your identity and sell it. You should change your password immediately. That said, in general, the "who has..." list within Messenger is accurate. There have been instances over the last six-months or so where the list (and m...

Check Box to display records with completed status only
Hi, I have a query whereby a record is lablelled complete if the "Completed date" field has a date in it, otherwise it is blank. I want to check box on a form when ticked, to display a report with completed records only. Can anyone help? Thanks, B/ On your form, you have a command button to open the report, and a check box named (say) chkCompleteOnly. If the check box is checked, you want to open the report to show only the records that have a date in the [Completed date] field. The event procedure for the command button's Click event would look like this: Priv...

Selecting from contacts list
I have all my contacts in the Contacts List and I want to delete all those with a common extension i.e. all those who have email addresses @hotmail. I am using Outlook 2007 Can you do a search or advanced search which will show the contact you want to delete? You should be able to highlight & delete them from the results. "GrahamC" <GrahamC@discussions.microsoft.com> wrote in message news:6AC1880D-9632-4ED9-BAE2-7083690B9FA7@microsoft.com... > I have all my contacts in the Contacts List and I want to delete all those > with a common extension i.e. all t...

Microsoft CRM needs the cookies to use the web client
When it loads the Microsoft CRM tool bar on the Web Client I receive the following message: At moment, your web browse is configured to disable cookies. Microsoft CRM needs the cookies to use the Web Client. What should I do? Thanks! "wanny" <wanny@discussions.microsoft.com> wrote in message news:C98DBCF0-096E-4DC3-A409-FC4A26E89E9C@microsoft.com... > When it loads the Microsoft CRM tool bar on the Web Client I receive the > following message: > > At moment, your web browse is configured to disable cookies. Microsoft CRM > needs the cookies to use the We...

SubForm: Preserving Selection Rectangle When Focus Lost?
One of my typical screens has a list of "Things" on the left side of the form and detail fields on the right side. As the user walks the list, details on the right side are updated to reflect the info behind the currently-selected "Thing". Works find. Visually-intuitive bc the ThingName on the list remains highlighted even though the user may click on one of the detail fields. On this app, one of the thing's properties is a "NeedsSpecialAttention" switch. If the switch is set, we need to emphasize that "Thing" - preferably on the list. To tha...

Script to list access right
Hi I am trying to find any script which would generate list of login users with certain access level (select, write etc.) at one particular database. Is there something like that? Thanks. Justin ...

a list of lists
currently i use CArray to keep track of a list of objects, but I don't know MFC classes well enough to keep track of a list of lists. I'd appreciate some suggestions "wanwan" <ericwan78@yahoo.com> ha scritto nel messaggio news:1187535523.924671.143350@j4g2000prf.googlegroups.com... > currently i use CArray to keep track of a list of objects, but I don't > know MFC classes well enough to keep track of a list of lists. I'd > appreciate some suggestions You might want to embedd your list based on CArray into a class (e.g. CListOfSomething), and then ...

Smart List export to Excel #2
Hi, We are using Dynamics 9.0 and Office 2003. When we try to do a Smart List export to Excel, we keep getting an "Exception_Class_Object_Exception" that references varying object errors, such as 'Cells' or 'Value'; the object errors will change each time we try an export. As a workaround, I've found that closing Excel before doing the export allows the export to complete successfully. However, that solution isn't acceptable, as our Dynamics users would like to be able to work in Excel, doing other tasks, while the export is processing. Does anyone...

List of different values in data area
Hi excel specialists, How Can I automatically get the list of different values from the dat area and to find out their frequence? INDIVIDUALLY MEASURED VALUES: 3,5 4 3,5 4 3 3,5 4 4 3 3,5 4 3 3,5 3 3 3,5 4 4 Thanks for your help in advance. Balcovja -- balcovj ----------------------------------------------------------------------- balcovja's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2623 View this thread: http://www.excelforum.com/showthread.php?threadid=39572 Take a look at FREQUENCY in Hep -- HTH RP (remove nothere from the email address if m...

Can data in one text box automatically appear in another?
I am trying to design a form in Publisher, and would like to link text boxes so that data entered in one will automatically appear in another on the same page. Is this feasible? How will this form be used? "G.O.G." <G.O.G.@discussions.microsoft.com> wrote in message = news:E4C951DF-7D4F-4FC1-8F6B-2C0B4EB8882A@microsoft.com... > I am trying to design a form in Publisher, and would like to link text = boxes=20 > so that data entered in one will automatically appear in another on = the same=20 > page. Is this feasible? Maybe with some programming... -- Mary Saue...

Global Address List and Handhelds
We use Ipaqs throughout the company, and I was wondering if there is anyway to have exchange add the GAL to the outlook contacts on the workstation, so that when they sync up, they will retrieve the Global Address List? In news:%23TkYtT0$GHA.3560@TK2MSFTNGP04.phx.gbl, Flip <phil.atkinson@beltek.com> typed: > We use Ipaqs throughout the company, and I was wondering if there is > anyway to have exchange add the GAL to the outlook contacts on the > workstation, so that when they sync up, they will retrieve the Global > Address List? No (and this wouldn't really be an ...

Fields in items list-- add/delete
Hai, I am using RMS version 1.2. In Stores Operations Manager it displays list of items when click on Database-->Items. It displays only five columns. Now i need to add / delete some fields in this list. Is it possible to add or delete the fields? if yes how can i add the fields? Thanks in advance, Nagendra On Wed, 27 Apr 2005 01:22:02 -0700, "Nagendra" <Nagendra@discussions.microsoft.com> wrote: >Is it possible to add or delete the fields? if yes how can i add the fields? I don't think so antonio ...

remove small list from large list
I have two mail lists on excel. The first has 16,000 names, the second has about 6,000. I need to remove the 6,000 from the 16,000 as they all appear in the big list as well. How do I extract those 6,000 entries from the larger list? My expected result is a mailing list with 10,000 names. Chip Pearson has some techniques at: http://www.cpearson.com/excel/duplicat.htm Howie J. wrote: > > I have two mail lists on excel. The first has 16,000 names, the second has > about 6,000. I need to remove the 6,000 from the 16,000 as they all appear > in the big list as well. How do ...

Jpeg's appearing as black boxes...
Version: 2008 I am new to using Word for Mac - having recently transferred from a PC. I am finding that some (not all) some documents are displaying the jpeg's on them as black boxes. Instead of the image the entire are is just black and prints this way also. The image displays correctly in the finder, but once the document is full size, the image is a black box. <br> Help please! How do I get my images back? <br><br>Thanks <br><br>Amber Hi Britamy: Chances are they are CMYK JPEGs. Word (or any other Microsoft Office application) can't handle CM...

To-do list
In Outlook 2007, I can't find a way to show a short summary of my e-mail inbox on my Calendar page, similar to the way Outlook shows a To-do list of calendar items on my Mail page. It would save me a lot of switching back and forth. If there is a way, please tell me. If not, maybe you could consider adding it to the next version of Outlook. Otherwise, I love the program. -- BB ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the mes...