Filter recordset between dates

Hi all...
I'm trying to filter a recordset on two dates using 'between' in my sql
I'm getting nowhere with it.
I'm using Dreamweaver 8.2 and access database.
Here is my code:
<%
Dim RSReport1__param1
RSReport1__param1 = "01-01-2000"
If (Request("reportfrom") <> "") Then
  RSReport1__param1 = Request("reportfrom")
End If
%>
<%
Dim RSReport1__param2
RSReport1__param2 = "01-01-2000"
If (Request("reportto") <> "") Then
  RSReport1__param2 = Request("reportto")
End If
%>
<%
Dim RSReport1
Dim RSReport1_cmd
Dim RSReport1_numRows
Set RSReport1_cmd = Server.CreateObject ("ADODB.Command")
RSReport1_cmd.ActiveConnection = MM_myconn_STRING
RSReport1_cmd.CommandText = "SELECT Count(Actions.ActionID) AS CountOfActionID, Actions.Department, ActionSource.SourceOfAction FROM ActionSource INNER JOIN (Actions INNER JOIN Department ON Actions.Department = Department.Department) ON ActionSource.SourceOfAction = Actions.SourceOfAction WHERE (((Actions.Date_Raised) Between #?# And #?#)) GROUP BY Actions.Department, ActionSource.SourceOfAction ORDER BY Actions.Department;"
RSReport1_cmd.Prepared = true
RSReport1_cmd.Parameters.Append RSReport1_cmd.CreateParameter("param1", 135, 1, -1, RSReport1__param1) ' adDBTimeStamp
RSReport1_cmd.Parameters.Append RSReport1_cmd.CreateParameter("param2", 135, 1, -1, RSReport1__param2) ' adDBTimeStamp
Set RSReport1 = RSReport1_cmd.Execute
RSReport1_numRows = 0
%>
No matter what i do, i just can't get the recordset to work.
Any ideas before i pull my teeth out???
I've also tried
<%
Dim RSReport1__param1
RSReport1__param1 = "01-01-2000"
If (Request("reportfrom") <> "") Then
  RSReport1__param1 = Request("reportfrom")
End If
%>
<%
Dim RSReport1__param2
RSReport1__param2 = "01-01-2000"
If (Request("reportto") <> "") Then
  RSReport1__param2 = Request("reportto")
End If
%>
<%
Dim RSReport1
Dim RSReport1_cmd
Dim RSReport1_numRows
Set RSReport1_cmd = Server.CreateObject ("ADODB.Command")
RSReport1_cmd.ActiveConnection = MM_myconn_STRING
RSReport1_cmd.CommandText = "SELECT Count(Actions.ActionID) AS CountOfActionID, Actions.Department, ActionSource.SourceOfAction FROM ActionSource INNER JOIN (Actions INNER JOIN Department ON Actions.Department = Department.Department) ON ActionSource.SourceOfAction = Actions.SourceOfAction WHERE (((Actions.Date_Raised) Between ? And ?)) GROUP BY Actions.Department, ActionSource.SourceOfAction ORDER BY Actions.Department;"
RSReport1_cmd.Prepared = true
RSReport1_cmd.Parameters.Append RSReport1_cmd.CreateParameter("param1", 135, 1, -1, RSReport1__param1) ' adDBTimeStamp
RSReport1_cmd.Parameters.Append RSReport1_cmd.CreateParameter("param2", 135, 1, -1, RSReport1__param2) ' adDBTimeStamp
Set RSReport1 = RSReport1_cmd.Execute
RSReport1_numRows = 0
%>
But get this error:
Datatype mismatch in criteria expression
Help Please!!!
Andy

Thanks bregent
I changed the type to 133 and the code is working now.
I still get the error in the Dreamweaver dialog box when i test the recordset, but the code works...
Thanks again
Andy

Similar Messages

  • Between Date parameter is not working.

    Hi All,
    This is my Dataset query. Other filters are working fine. I am getting out put when i select date range. But Its not working when i select Null Option (That time i should get all the data).  but Its not working.
    SELECT DISTINCT
    PartnerId, [Partner Name], [Partner Site], [Organization/Country Code], [Accreditation Name], [Accreditation Status], [Accreditation Review Date],
    CONVERT(varchar(90), [Accreditation End Date], 105) AS [Accreditation End Date], CONVERT(varchar(90), [Accreditation Start Date], 105) AS [Accreditation Start Date],
    [Accreditation Code], [Specialization Code], Name, Inheritance, Description, Territory, Level
    FROM P1_Addition_Report
    where BU in (@BU) and Level In (@Level) and [Accreditation Name] in (@AccreditationName) and ([Accreditation Start Date] Between @Eligibility_StartDate and @Eligibility_Enddate) or (@Eligibility_StartDate is null and @Eligibility_Enddate is null)
    Can anyone correct this query or suggest any alternatives
    Thanks in Advance

    Thanks for reply. Actually with the code i have pasted i am able to get output for Between date. but the problem is I have 5 Filters . when i select null. Its not considering the filters. Instead of that it is considering all data.
    PFB screenshot for filter.. Please help to rectify this
    See the way I wrote WHERE clause. If you write like that it will still apply the other filters even when date is NULL
    where BU in (@BU) and Level In (@Level) and [Accreditation Name] in (@AccreditationName)
    and ([Accreditation Start Date] >= @Eligibility_StartDate or @Eligibility_StartDate is null)
    and ([Accreditation Start Date] < @Eligibility_Enddate+1 or @Eligibility_Enddate is null)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Need help to join two tables using three joins, one of which is a (between) date range.

    I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
    the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
    ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
    [ABCTABLE]
    ABCORDER
    ABCPART
    ABCSERIAL
    ABCDATE
    [ZYXTABLE]
    XYZORDER
    XYZPART
    XYZSERIAL
    XYZDATE1
    XYZDATE2

    Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
    on this computer. There are no "Null" fields in either of the tables. 
    This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
    [MSORDR]
    MSORDER
    MSPART
    MSSERIAL
    MSOPNDATE
    11111111
    4444444
    55555
    2/4/2015
    22222222
    6666666
    11111
    1/6/2015
    33333333
    6666666
    11111
    3/5/2015
    This table has one order for every part number and every serial number.
    [GLORDR]
    GLORDER
    GLPART
    GLSERIAL
    GLSTARTDATE
    GLENDDATE
    ABC11111
    444444
    55555
    1/2/2015
    4/4/2015
    ABC22222
    666666
    11111
    1/5/2015
    4/10/2015
    AAA11111
    555555
    22222
    3/2/2015
    4/10/2015
    Post Query table
    GLORDER
    MSORDER
    GLSTARTDATE
    GLENDDATE
    MSOPNDATE
    ABC11111
    11111111
    1/2/2015
    4/4/2015
    2/4/2015
    ABC22222
    22222222
    1/5/2015
    4/10/2015
    1/6/2015
    ABC22222
    33333333
    1/5/2015
    4/10/2015
    3/5/2015
    This is the SQL minus the between date join.
    SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
    FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART);

  • What is difference between data base structure and stucure  in program

    what is difference between data base structure and stucure  declared in program  level . can  explain cleary if knows

    Hi,
    Data base structure is global decalaration you can reffer this structure in any of your developments, when ever you cahange this structure the changes automatically will get updated in all the programs.
    coming to structures in program it is local to your program only, if you want to change the structure again you have to open the program and do the necessary changes.
    Reward if useful.
    Thanks,
    Sreeram.

  • Returne between dates in case when

    i want to return between dates values on case when clauses on where clauses
    like
    and
    (case
    when (cc.segment3 NOT like '4%' and cc.segment3 NOT like '5%')
    then (between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr'))
    when (cc.segment3 like '4%' or cc.segment3 like '5%')
    then (between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr'))
    end) h.default_effective_date
    the problem is in the = operator but i don't know haw to use this
    any help??

    ok here is the full coad
    select
    DECODE(SUBSTR (CC.segment1, 1, 1), 'J', 'OFFSHORE', 'I', 'OFFSHORE','IN COUNTRY')branch_nature,
    decode(cc.segment1,'A6260','Head Office','Branches') branch_type,
    cc.segment1,
    decode (h.currency_code,'EGP','mahly','agnaby') currency_code ,
    cc.segment3,
    t.description,
    CASE
    when h.currency_code in('EGP') then sum(l.entered_cr)
    else 0
    end entered_cr,--sum(l.entered_cr) entered_cr,
    CASE
    when h.currency_code in('EGP') then sum(l.entered_dr)
    else 0
    end entered_dr, --sum(l.entered_dr) entered_dr,
    CASE
    when h.currency_code NOT in('EGP') then sum(l.accounted_cr)
    else 0
    end accounted_Dr,--0 accounted_Dr,
    CASE
    when h.currency_code NOT in('EGP') then sum(l.accounted_dr)
    else 0
    end accounted_cr --0 accounted_cr
    from apps.gl_je_headers h,
    apps.gl_je_lines L,
    apps.gl_code_combinations cc,
    apps.fnd_flex_values_tl t ,
    applsys.fnd_user us,
    apps.gl_je_batches b
    where h.status = 'P'
    and us.user_id = h.Created_by
    --and h.currency_code in('EGP')
    and l.je_header_id = h.je_header_id
    and l.code_combination_id =cc.code_combination_id
    and cc.segment3 = t.flex_value_meaning
    and cc.segment3 in ('31000020','40505020')
    and cc.segment1 in ('A5550','B0010')
    -- and (DECODE(SUBSTR (CC.segment1, 1, 1), 'J', 'OFFSHORE', 'I', 'OFFSHORE','IN COUNTRY') =:P_branch_nature OR :P_branch_nature is NULL)
    --and (decode(cc.segment1,'A6260','Head Office','Branches') = :P_BRANCH_TYPE OR :P_BRANCH_TYPE is NULL)
    and t.description is not null
    and t.language ='AR'
    and h.je_batch_id = b.je_batch_id
    and
    (case
    when (cc.segment3 NOT like '4%' and cc.segment3 NOT like '5%')
    then (between to_date(:P_Start_date,'dd/mm/rrrr') and to_date(:P_END_date,'dd/mm/rrrr'))
    when (cc.segment3 like '4%' or cc.segment3 like '5%')
    then (between to_date(:P_Start_date2,'dd/mm/rrrr') and to_date(:P_END_date,'dd/mm/rrrr'))
    end) h.default_effective_date
    and (case
    when (cc.segment3 like '4%' or cc.segment3 like '5%')
    then (h.default_effective_date)
    end) between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr')*/
    group by cc.segment3 , t.description , cc.segment1,h.currency_code;
    the part between tages need to modigied

  • Difference between Data staging and Dimension Table ?

    Difference between Data staging  and Dimension Table ?

    Data Staging:
    Data extraction and transformation is done here.
    Meaning that, if we have source data in flat file, we extract it and load into staging tables, we take care of nulls, we change datetime format etc.. and after such cleansing/transformation at then end, load it to Dim/Fact tables
    Pros: Makes process simpler and easy and also we can keep track of data as we have data in staging
    Cons: Staging tables need space hence need memory space
    Dimension Table:
    tables which describes/stores the attribute about specific objects
    Below is star schema which has dimension storing information related to Product, Customer etc..
    -Vaibhav Chaudhari

  • Difference between date info object in characteristics and keyfigure

    What is the difference between "date" data type in characteristic and keyfigure?
    Thanks in advance.
    Raj

    Hi Rajasekhar,
    If date is characteristics,query can be analysed based on date and filters can also be set using this date.
    If it is key figure query cannot be analysed based on date,
    Based on requirements,we have to decide whether it should be chatracteristic or key figure
    Regards
    Prakash

  • How to count the days between Date Range using OO ABAP?

    hi experts,
            i want to count the days between Date Range using OO ABAP for that  which class and method  can i use?.
    Thanks,
    Mahesh.

    Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
    REPORT zz_date_diff.
    CLASS date_diff DEFINITION.
      PUBLIC SECTION.
        METHODS diff IMPORTING     i_date_fm TYPE d
                                   i_date_to TYPE d
                     EXPORTING     e_days    TYPE i.
    ENDCLASS."
    CLASS date_diff IMPLEMENTATION.
      METHOD diff.
        e_days = i_date_to - i_date_fm.
      ENDMETHOD."
    ENDCLASS."
    DATA: g_ref TYPE REF TO date_diff,
          g_days  TYPE i,
          g_date_fm  TYPE d VALUE '20080101',
          g_date_to  TYPE d VALUE '20090101'.
    START-OF-SELECTION.
      CREATE OBJECT g_ref.
      CALL METHOD g_ref->diff
        EXPORTING
          i_date_fm = g_date_fm
          i_date_to = g_date_to
        IMPORTING
          e_days    = g_days.
      WRITE g_days.

  • Customizing distance between data Points on x-Axis

    Hi,
    I want to draw a LineChart.
    I have these Timestamps [84, 1000, 34000, 34699, 439999] who
    are represanting the x-Value of DataPoints along the X-Axis.
    Unfortunately the distance between 2 datapoints along the
    x-Axis is always the same, that means that between the points with
    x-values 84 and 1000 is the same distance along the axis as between
    the points with x-values 34699 and 439999.
    But the distance between points with x-values of 34699 and
    439999 should be much greater than between 84 and 1000.
    How can I customize the distance between data Points on a
    LineChart to solve my Problem?
    I really dont know right now!
    Greeting,
    Z.

    "zidaninho" <[email protected]> wrote in
    message
    news:gls479$nkt$[email protected]..
    > Hi,
    >
    > I want to draw a LineChart.
    > I have these Timestamps [84, 1000, 34000, 34699, 439999]
    who are
    > represanting
    > the x-Value of DataPoints along the X-Axis.
    >
    > Unfortunately the distance between 2 datapoints along
    the x-Axis is always
    > the
    > same, that means that between the points with x-values
    84 and 1000 is the
    > same
    > distance along the axis as between the points with
    x-values 34699 and
    > 439999.
    > But the distance between points with x-values of 34699
    and 439999 should
    > be
    > much greater than between 84 and 1000.
    >
    > How can I customize the distance between data Points on
    a LineChart to
    > solve
    > my Problem?
    >
    > I really dont know right now!
    What happens if you convert the time stamps to Dates and use
    a DateAxis?

  • Filter out two dates in Infopackage on the same field

    Hi!
    I have this code in a infoPackage that gives me the current month intervall (if not the day is the first of a month, then it gives me previous month ). I need to add a change to this code. I would like to also filter out the date '25001231' (this is a dummy for empthy values).
    So I need both the intervall (as it is defined in the code), and a spesific date.. I have tried but I can't get it to work. Please help
    Data: l_idx like sy-tabix,
            date_low1 like sy-datum,
            date_low2 like sy-datum,
            date_high1 like sy-datum,
            date_high2 like sy-datum,
            rep_date like sy-datum.
      rep_date = sy-datum.
      read table l_t_range with key
      fieldname = 'RESOLVED_DATE'.
      l_idx = sy-tabix.
    *If the date is not '01' in the current month the loading is started on,
    *this will be triggered.
      IF rep_date+6(2) <> '01'.
    *Here we define the first date in the range, day is always '01'.
        Date_low1 = rep_date.
        date_low1+6(2) = '01'.
    *Here we put in the date we have be given, and get out
    the last day of the month.
        CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
          EXPORTING
            DAY_IN            = Date_low1
          IMPORTING
            LAST_DAY_OF_MONTH = date_high1.
        Move date_low1 to L_T_Range-Low.
        Move date_high1 to L_T_Range-High.
        L_T_Range-Sign = 'I'.
        L_T_Range-Option = 'BT'.
        modify l_t_range index l_idx.
        p_subrc = 0.
    *If the date is '01' in the current month the loading is started on,
    *this will be triggered.
      Elseif rep_date+6(2) = '01'.
    *if the day is '01' we need to extract the previous month data.
        Date_low2 = rep_date - 1.
        date_low2+6(2) = '01'.
        CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
          EXPORTING
            DAY_IN            = Date_low2
          IMPORTING
            LAST_DAY_OF_MONTH = date_high2.
        Move date_low2 to L_T_Range-Low.
        Move date_high2 to L_T_Range-High.
        L_T_Range-Sign = 'I'.
        L_T_Range-Option = 'BT'.
        modify l_t_range index l_idx.
        p_subrc = 0.
      ENDIF.

    Hi Helge
    I verified the below in my system its working now.
    Data: l_idx like sy-tabix,
    date_low1 like sy-datum,
    date_low2 like sy-datum,
    date_high1 like sy-datum,
    date_high2 like sy-datum,
    rep_date like sy-datum.
    rep_date = sy-datum.
    *l_idx = sy-tabix.
    *If the date is not '01' in the current month the loading is started on,
    *this will be triggered.
    IF rep_date+6(2) ne '01'.
    *Here we define the first date in the range, day is always '01'.
    Date_low1 = rep_date.
    date_low1+6(2) = '01'.
    *Here we put in the date we have be given, and get out
    * the last day of the month.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
    EXPORTING
    DAY_IN = Date_low1
    IMPORTING
    LAST_DAY_OF_MONTH = date_high1.
    break sbhaskar.
    Move date_low1 to L_T_Range-Low.
    Move date_high1 to L_T_Range-High.
    L_T_Range-Sign = 'I'.
    L_T_Range-Option = 'BT'.
    modify l_t_range index sy-tabix.
    p_subrc = 0.
    *If the date is '01' in the current month the loading is started on,
    *this will be triggered.
    Elseif rep_date+6(2) = '01'.
    *if the day is '01' we need to extract the previous month data.
    Date_low2 = rep_date - 1.
    date_low2+6(2) = '01'.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
    EXPORTING
    DAY_IN = Date_low2
    IMPORTING
    LAST_DAY_OF_MONTH = date_high2.
    Move date_low2 to L_T_Range-Low.
    Move date_high2 to L_T_Range-High.
    L_T_Range-Sign = 'I'.
    L_T_Range-Option = 'BT'.
    modify l_t_range index sy-tabix.
    p_subrc = 0.
    ENDIF.

  • IIf condition between dates using mdx query

    Hi,
    how to check IIF condition between dates using mdx query.
    I able to check single year,plese check below mdx query.I need to check members between years.
    my requirement is member is belongs to between years(2007 to 2010),display "yes" else "NO";
    Could you please give me exact mdx query.
    From,to-2007,2010,if member belongs to 2007to 2010 then disply "yes"else "no".
    how to pass two members in IIf condition.
    WITH
    MEMBER Measures.[test]
    AS Iif([Date].[Calendar Year].currentmember
    is [Date].[Calendar Year].&[2007],"no","yes")
    SELECT {Measures.[test]}
    on 0
    ,[Product].[Subcategory].[Subcategory].MEMBERS * [Date].[Calendar Year].[Calendar Year]
    ON 1
    FROM [Adventure Works]
    indu

    Hi Sriindu,
    consider the following:
    WITH
    MEMBER measures.[test] AS
    IIF
    Exists
    [Date].[Calendar Year].CurrentMember
    [Date].[Calendar Year].&[2007] : [Date].[Calendar Year].&[20010]
    ).Item(0)
    IS
    [Date].[Calendar Year].CurrentMember
    ,"yes"
    ,"no"
    SELECT
    {measures.[test]} ON 0
    [Product].[Subcategory].[Subcategory].MEMBERS
    [Date].[Calendar Year].[Calendar Year] ON 1
    FROM [Adventure Works];
    Philip,

  • EA1 - Filter on table Data Tab

    entering a statement into the filter on the data tab of a table works fine. However, once you click on another tab - e.g an SQL Worksheet / saved Script or Other table, then click back, the statement you entered will have magically disappeared.
    Windows XP SP2
    10g (AFAIK 10.2)
    Message was edited by:
    Rab_McA

    I also think applying the filter on leaving the tab isn't really desired behaviour; the user should apply explicitly hitting ENTER.
    Right now, you could start entering a filter, reconsider half way, change tabs, and you'd get an error about the wrong filter syntax.
    Additionally, this (and any other) bad filter is saved to the new (and loved) filter history. It would make sense only logging working filters, right?
    Thanks,
    K.

  • Validating is between date prompt

    Is there a way to validate the is between date prompt in OBIEE?
    The user should not be able to select a end date which is earlier than the start date.

    hi,
    How about this?
    http://shivabizint.wordpress.com/2009/04/21/date-between-validation-for-dashboard-prompt/
    before doing,take a backup of your .js file
    thanks,
    saichand.v

  • Connection between data services and BWA

    Hi,
    I want to make a connection between Data Services 3.2 and BWA. Since we use RFC connection in between in order to have them talk with eachother but i wonder if there is any documentation that describes the RFC connection and configuration required particularly in this scenario. I have gone through the documentation that explains RFC connection between Data Services and BW and what configuration we have to do, so i wonder if there are any functions we have to export to BWA from Data Services like we do in case of BW connection to Data Services or some specific configuration we have to do. If someone help who has done connection between Data Services and BWA can help or if somebody can provide documentaton on it.

    Hi,
    You should ask this question over here: http://scn.sap.com/community/data-services
    Regards,
    H

  • In Between date prompt

    I have a requirement to create a prompt where there are two dates
    FROM_DATE
    TO_DATE
    Need to put between date functionality that goes like this,
    Between FROM_DATE and TO_DATE.
    This is easy to implement if there is just one date column, in this case there are two date columns.
    Any ideas?

    The wrinkle I use is to create a formula; -
    case when 1=2 then 0 else 1 end
    I then put a prompt on this and repoint it at the date in question as my TO condition.
    hope this helps,
    Robert.

Maybe you are looking for

  • Jdeveloper error when testing a web service

    Hi, I keep getting the error below when testing a webservice, I have unistalled and reinstalled jdeveloper but still getting this error, help would be gratefully appreciated? [Waiting for the domain to finish building...] [10:58:59 AM] Creating Integ

  • Edit, read only, disable, blur items. Which to use?

    I've searched the forum and have found some threads that somewhat discuss my question, but none have addressed it specifically. I have a page that has 20 or so items on it. There are 3 fields (like status) that determine which items may be edited, so

  • Unicode Conversion  in Downtime Minimized Strategy

    Hi, Whether a Unicode Conversion can be done in a Downtime Minimized Strategy as what we have in Application Upgrade? Regards, Sam

  • Moving 10.2.0.1.0 to 10.2.0.4.0 to 10.2.0.5.0

    OS: Windows Server 2008 R2 64 bit Downloaded *10204_vista_w2k8_x64_production_db.zip* from http://www.oracle.com/technetwork/database/10204-winx64-vista-win2k8-082253.html After following ID1173433.1 (intall 10gR2 on MS Windows 7/Windows 2008R2), suc

  • Sharpening in RAW CS5

    I have recently upgraded to CS5. In Raw, Before sharpening I apply a mask of approx. 75%. As I move the sharpening slider over (while holding ALT to view the sharpenng), I can see the sharpening effect amplifying noise- even in the areas that are com