How Do I Filter a Report Using a Multi Select List Box and Specifying Date Between Begin Date and End Date

Hope someone can help.  I have tried to find the best way to do this and can't seem to make sense of anything.  I'm using an Access 2013 Database and I have a report that is based on a query.  I've created a Report Criteria Form.  I
need the user to be able to select multiple items in a list box and also to enter a Begin Date and End Date.  I then need my report to return only the records that meet all selected criteria.  It works fine with a ComboBox and 1 selection but can't
get it to work with a List Box so they can select multiple items.  Any help is greatly appreciated while I still have hair left. 

The query should return all records.
Let's say you have the following controls on your report criteria form:
txtStart: text box, formatted as a date.
txtEnd: text box, formatted as a date.
lbxMulti: multi-select list box.
cmdOpenReport: command button used to open the report.
The text boxes are used to filter the date/time field DateField, and the list box to filter the number field SomeField.
The report to be opened is rptReport.
The On Click event procedure for the command button could look like this:
Private Sub cmdOpenReport_Click()
Dim strWhere As String
Dim strIn As String
Dim varItm As Variant
On Error GoTo ErrHandler
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " AND [DateField]>=#" & Format(Me.txtStart, "yyyy-mm-dd") & "#"
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " AND [DateField]<=#" & Format(Me.txtEnd, "yyyy-mm-dd") & "#"
End If
For Each varItm In Me.lbxMulti.ItemsSelected
strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
Next varItm
If strIn <> "" Then
' Remove initial comma
strIn = Mid(strIn, 2)
strWhere = strWhere & " AND [SomeField] In (" & strWhere & ")"
End If
If strWhere <> "" Then
' Remove initial " AND "
strWhere = Mid(strWhere, 6)
End If
DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, WhereCondition:=strWhere
Exit Sub
ErrHandler:
If Err = 2501 Then
' Report cancelled - ignore
Else
MsgBox Err.Description, vbExclamation
End If
End Sub
If SomeField is a text field instead of a number field, change the line
        strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
to
        strIn = strIn & "," & Chr(34) & Me.lbxMulti.ItemData(varItm) & Chr(34)
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • How to un-check everything in a Multi-selection list box in SP2013?

    When a radio button is selected/un-selected, i would like to clear all the checkboxes that were checked in a MSLB.  I created a rule for the condition but in the action, how to create this uncheck action?
    Thank you

    yes, that's what I've done but still not working.  I even downloaded the sp, 
    InfoPath 2013 (KB2837648) 32-Bit Edition
    and it still doesn't work.  In the screen shot attached, ml prefix is for Multi-selection list box.  So, in mlImprovement, if the Communication checkbox isn't checked then set the Multi-selection list box, Communicaiton, to blank so it should
    show no selection.
    In the preview of Infopath 2013, I would check Communication in mlImprovement and then check a couple of checkboxes in mlCommunicaiton.  I then uncheck and check Communicaiton in mlImprovement and those previously checked checkboxes remains.
    I have been very frstrated working the MLSB infopath 2013.  there are other issues that does't work either.  Please advise if I'm missing a step here and there, thank you.

  • Reporting on a Multi-Select list field X:Y:Z

    I'm sure someone must have come across this problem but I can't find a reference to it on the forum.
    PROBLEM
    I have a data entry form with multi-select lists. Users choose a number of display values and the return values are stored in the field in the format
    20:30:50
    When I create an SQL report on a row, there is no option to Display the column as a "multi-select list" like there is with a standard List of Values.
    How do I report the display lookup values rather than the return code?
    Is it possible to display the selected values in a report for example
    red
    orange JOHN 10-JAN-07
    green
    red
    orange MARY 12-FEB-07
    orange
    green MARK 13-JUL-07
    regards
    Paul P

    Paul,
    I have several examples on this topic:
    http://htmldb.oracle.com/pls/otn/f?p=31517:87
    http://htmldb.oracle.com/pls/otn/f?p=31517:84
    http://htmldb.oracle.com/pls/otn/f?p=31517:75
    Basically, you will need to create a table out of your colon separated values and then
    join this table with other tables to be able to display it however you want.
    What just comes to my mind is that Dietmar presented a nice workarround for a similar
    problem here:
    Nested report howto?
    Denes Kubicek

  • How to extract information in cells of a mult-column list box?

    I have multi column list box. At run time this listbox allow me to select entire row (this is fine), how to extract the data from each cell along the selected row? It seems to me that the Multi column Listbox (MCL) is merely a 1D array (I guess index of this 1D array corresponds to row index of the MCL and value of the element corresponds to column index of MCL.)

    To extract cell values of the selected row, you can create a property node for the MCL. From this property node, choose "Item Names". This is a 2D array containing all cell values. Index this array with the MCL terminal. Note that you must choose the scalar data type for the MCL. To choose the scalar data type, right click on the MCL and go to "Selection Mode"->"Data Type"->"Scalar".
    See attachment written with LabVIEW 6.
    I hope it will help you.
    Attachments:
    MCL.vi ‏15 KB

  • How do I change ALL cells in a Multi-Cloumn List box at one time ?

    I would like to change ALL of the Cells in a Multi-Column Listbox at one time. Both, with the Editor and Programmatically. Any Ideas ?

    Programmatically:
    Use "Active cell" property node, create constant and type "-2" in both elements of the cluster constant.
    Note: the first element is for the raw, the second for the column. -1 and -2 have special meanings.
    -1: header of column (listbox has no header for the raws)
    -2: all cells (of raw or column)
    So for example:
    -2;0: all cells of column 0 (with header)
    -2; -2: all cells (with header)
    -1;0: header of column 0
    -1;-2: header of all columns

  • Using Multi Select List in SQL Query

    Hi all,
    I am trying to using a Multi Select list for filtering of a report. I have :P2_RISK_SEVERITY which has has the possibility of values Very Low:Low:Medium:High:Very High. How do I use this Multi Select in the where section of a SQL query?
    I need to say something along the lines of:
    Select RISK_SEVERITY from TBL_RMD_RISKS where RISK_SEVERITY = (one of the options selected in the multi select)
    Thanks for the help.

    Hi there,
    The above suggestion will work perfectly as long as the table you're querying is relatively small, but keep in mind that applying the INSTR to the left side of the WHERE clause will always result in a full table scan. This means that if your table is large and RISK_SEVERITY is indexed, the index will never be used. Here is another approach (credit to AskTom) that converts your colon-delimited string of selected values to a list that can be used in an "IN(...)" clause, which will use an index on RISK_SEVERITY as long as the optimizer otherwise deems it appropriate:
    -- creates a type to hold a list of varchars
    CREATE OR REPLACE TYPE vc2_list_type as table of varchar2(4000);
    -- converts a colon-delimited string of values to a list of varchars
    CREATE OR REPLACE FUNCTION vc2_list(p_string in varchar2)
       return vc2_list_type is
       l_string       long default p_string || ':';
       l_data         vc2_list_type := vc2_list_type();
       n              pls_integer;
    begin
       loop
          exit when l_string is null;
          n := instr(l_string, ':');
          l_data.extend;
          l_data(l_data.count) := ltrim(rtrim(substr(l_string, 1, n - 1)));
          l_string := substr(l_string, n + 1);
       end loop;
       return l_data;
    end vc2_list;
    -- your WHERE clause
    where risk_severity in(
             select *
               from the(select cast(vc2_list(:P2_RISK_SEVERITY) as vc2_list_type)
                          from dual))
    ...Hope this helps,
    John

  • How to insert data to the specified row column of the multi column list box

    Hi All
    How do i insert data into the specified column of the multi cplumn list box?
    I have a table that containsall station nos and name.Then another table contains the data the various stations having at  for 24 hrs.That is 12 am to 11 pm.
    And i want to display each stations details as follows using a multi column list box/table
    My stationinfo table
    stnno   stnname......................
    s1           stn1
    s2            stn2
    s3             stn3
    The other table
    stnno      sysdatetime       data
    s1             12am                   1
    s2              12am                   4
    s1               1  am                 2
    So the station s1,s2.... will have data for 24 hrs.
    And i want to display it as follows using a multicolumn listbox
    stnname        12am   1 am ......................................11pm
    s1                   ...................
    s2                 ........................
    What i have in my  mind is to get all station nos
    and in a for loop get the station's data from 12 am to 11 pm
    or
    select every statios data for each hor.But in this case i have to query the database 24 times.So i dont think its a good way.
    Or any other better query available?
    Can anybody suggest me a good idea?
    One more thing...how to insert data into the specified field row or column of a multi column list box?
    Thanks in advance

    hi
    i want to know,,can u say ur need clearly...and i attached two image u see that one
    Indrajit
    | [email protected] | [email protected] .
    Attachments:
    station.JPG ‏35 KB
    station2.JPG ‏79 KB

  • How to prevent multi-column list box showing an extra column

    I am using a multi-column list box to display data and to allow the user to enter new values. More columns are used than are actually displayed within the bounds of the listbox control. Using an event structure the user is able to scroll left and right along the columns of the list box to select the appropriate field. I am using the 'Edit Position' property to highlight the particular field that the user is selecting. This technique works well and the listbox scrolls left and right to display the selected fields correctly.
    If the listbox has, say, 10 columns with only 5 being visible within the displayed width, then I clamp the Edit Position to a maximum column value of 9 to prevent the list box from continuing to scroll right into unused columns. This works fine, except that when the user scrolls to the 10th column, the listbox control always shows a blank 11th column. The 11th column cannot be selected. It would appear that this is default behaviour for the listbox control in that an additional column is always displayed relative to the Edit Position. In my particular application it is untidy to have this blank column appearing. I have tried a workaround by programmatically writing to the 'TopLeft' property of the listbox. This partially works by ensuring that the blank 11th column is never displayed, however, despite the Edit Position being correct to select the 10th column, the field in the 10th column is no longer highlighted and the user cannot enter a new value.
    Does anyone know of a method for preventing the blank additional column from appearing?

    Ok - I have attached an example which demonstrates the issue. This is produced with LV 2012. Open the project and then the 'Multi column listbox.vi'. Run the vi and use the right/left arrows to move between cells in the listbox. Observe that unused (unwanted) columns are always displayed to the right.
    Thanks for any help..
    Attachments:
    Test Multi column listbox.zip ‏62 KB

  • How to create a crystal Report using C# and SQL Server

    Hi, im new in creating crystal report using SQL Server, and im making a project.. and could someone help me how to connect your .sdf (SQL Server File) from the bin to your crystal report? thanks a lot.. i followed some instructions like this one (https://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?forum=csharpgeneral)
    but i got an error on the adding of server name and database portion.. thanks a lot in advance

    Hello,
    Crystal Reports are supported on
    http://scn.sap.com/community/crystal-reports.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How to create a single report using 5 difftent reports

    Hi Experts
    how to create a single report using 5 repors in it.
    Example
    I have to create a Survey history report using
    Reports like Surevy 1
                      Surevy 2
                      Surevy 3
                      Surevy 4
                      Surevy 5
    Please suggest me.
    Santosh

    Use Analysis Process Designer (RSANWB) to feed each of the survey BEX reports to one DSO.  Assuming each of the surveys has something in common to compare.  Could also be used as a snapshot storage for the surveys in case history needs to be compared/archived. 
    Build the Direct update DSO with the survey objects.  Add needed time characteristics and/or version control objects to the key. 
    Data sources  will be the 5 surveys. 
    Add formula to hardcode version/time for history.
    Data target is the direct update DSO.
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/49/7e960481916448b20134d471d36a6b/frameset.htm
    -SM

  • How to create cross tab reports using RAS SDK api with Crystal Reports XI

    Hi Everybody,
    Iam generating reports in a web-based application with Crystal Reports XI using Report Application Server(RAS) SDK API. The columns in my report exceed that of an A4 sized page. So, when I export that report to pdf, only those columns that fit to a page are showing up. To solve, this problem, I thought of using cross tab. But, I donot know how to generate cross tab report using RAS SDK API. I have tried to get some code from the internet. But, I did not find any java code for that.Can some one give me some sample code.It is very urgent.
    Thanks in advance.

    Hi,
    The easiest way I use is to create the worksheet as regular table and then when i verify the data I get (non aggregate) I duplicate it as a cross tab.
    In the duplication wizard I just need to define the axis (using drag and drop).
    if you want to create a cross tab from the beginning you need to define that in the new workbook wizard (check the "cross tab" rather then "table"), chose your fields and define the place you want them.
    The data point (the center of the cross tab) is aggregated as to your machine definition and will happen automatically.
    for example: to find the amount of receipt by months:
    On the left put the "Buyer Name", on top put the "Months" and in the data point put the amount.
    What you'll get is something like:
    months: jan feb mar apr ......
    buyer_name
    jhon_smith 100 50 30 250 ......
    jhon_doe 80 45 90 453 ........
    and so on.....

  • How do i display Jasper Report Using Jsp

    Hi,
    Can anyone give me the code snippet of how to display a jasper report using jsp
    Thanx in advance
    --H                                                                                                                                                                                                                                           

    JasperReport jasperReport =
    JasperCompileManager.compileReport(file);
    JasperPrint jasperPrint = JasperFillManager.fillReport(
    jasperReport, null, conn);
    JasperExportManager.exportReportToHtmlFile(
    jasperPrint, tDest);
    JasperViewer.viewReport(jasperPrint);
    //replace file -> .jrxml file source path
    conn -> database connection name
    tDest -> .html file destination

  • How do you filter entities by properties in the Distribution List?

    Hello, experts:
    Can you tell me how I can filter entities by property in the Distribution List? For example, I only want to distribute the input schedule to the entities that have a "PROJECTLVL" property of "Y".
    Thank you.
    Bei

    A lot of the collective consciousness:
    How to improve your experience with Apple Support Communities ( ASC )
    Easiest way to all User Tips on Using ASC may be to add " /content " to the URL then click the User Tips Category TAB
    *some User Tips have some of the same stuff but also some unique
    SITEMAP | Apple Support Communities has some gems as well

  • How can i keep the music pushed to all of families devices but the calendar and notes just between my phone and my mac using icloud?

    Ok, so my whole family has the same apple ID so that we can all get the same music, and we want to be able to use icloud so that when one person buys a song it will push to all of our devices. But the problem is when I want my calendar on my mac to also be pushed to my phone it pushes to all of my familys devices. How can i keep the music pushed to everyones but the calendar and notes just between my phone and my mac using icloud?

    Oops my bad...I see that during my troubleshooting I inadvertently left Ringtones unchecked in iTunes.

  • HT2731 my wife and I share an itune account. we both have our own iphone and ipad. how do i share my contacts and calander information between my iphone and ipad but not own her devices

    my wife and I share an itune account. we both have our own iphone and ipad. how do i share my contacts and calander information between my iphone and ipad but not own her devices

    Have her get her own Apple ID and then set up Family Sharing: Start or join a family group using Family Sharing - Apple Support

Maybe you are looking for

  • Error while processing ADOBE interactive form

    Hi, I get following error when I try to submit an ADOBE interactive form. FormPostprocessor.ERROR_NO_DEFAULT_USER_FOR_ROLE com.sap.caf.eu.gp.base.exception.EngineException: FormPostprocessor.ERROR_NO_DEFAULT_USER_FOR_ROLE at com.sap.caf.eu.gp.model.i

  • Table source, mapped column, result list

    Hi! I need to show in result list some field from my table (orderNo). Each row in table is an order item, with content column (orderInfo) which I intrested to indexing. But when I map orderNo column (I forced to map because without it I can't operate

  • Photoshop elements 10 won't open up Nikon d4s RAW files

    Photoshop elements 10 will not open up my RAW files from my new Nikon D4S.  My Nikon d700 RAW files tranfers fine.  I have updated my Camera RAW to 6.7 but it still does not open.  I do not want to convert my NEF files to DNG because you lose data. 

  • What happened to Big Time Moms

    What happened to the latest episode of Big Time Rush? Sunday afternoon it was in the store and when I went to watch it it was the previous episode. When I went back to the store it was no longer available.

  • Setting Browser Title

    we are running forms in the browser itself not in a seperate frame. Does anyone has any idea about how to set the browser title from Forms or using Java in Forms. I know that we can set it in the HTML file but we want to display the login information