trying to look at dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sparks

    #1

    trying to look at dates

    Right now I had to build a report that allowed the people to check for
    gross outliers in their data input.
    short I am looking at 2.5* std dev + -

    anyway I used 2 dummy variables in the query the report is tied to.
    start date and end date. This pops up an input box for these values
    and they put in 11/01/08 and 11/31/08 and it runs the report showing
    the outliers.
    I watched and everyone is looking at month not date
    Now I was thinking instead fof this in the query under recDATE
    >=[start_date] And <=[end_date]
    is there a way of just asking for a month and year and then comparing
    the recDATE without day in it?

    so one check for a new input of CKdate being 11/08

    Later I might even do something first to ask month or range.

  • Salad

    #2
    Re: trying to look at dates

    sparks wrote:
    Right now I had to build a report that allowed the people to check for
    gross outliers in their data input.
    short I am looking at 2.5* std dev + -
    >
    anyway I used 2 dummy variables in the query the report is tied to.
    start date and end date. This pops up an input box for these values
    and they put in 11/01/08 and 11/31/08 and it runs the report showing
    the outliers.
    I watched and everyone is looking at month not date
    Now I was thinking instead fof this in the query under recDATE
    >
    >
    >>=[start_date] And <=[end_date]
    >
    >
    is there a way of just asking for a month and year and then comparing
    the recDATE without day in it?
    >
    so one check for a new input of CKdate being 11/08
    >
    Later I might even do something first to ask month or range.
    >
    ? format(date()," yyyymm")
    200810
    ? datepart("m",da te())
    10
    ? datepart("d",da te())
    15
    ? datepart("yyyy" ,date())
    2008

    Using Format or DatePart you should be able to create a criteria string
    to pass when opening the report. Notice that Format returns a string
    value and DatePart a numeric value. You could also use Year(), Month(),
    Day() as well.

    Comment

    • Tom van Stiphout

      #3
      Re: trying to look at dates

      On Wed, 15 Oct 2008 12:56:15 GMT, sparks <sparks@comcast .netwrote:

      I would suggest you create a Criteria form, where the user can enter a
      Month and Year. You then turn that into a date range which you feed to
      the report.

      -Tom.
      Microsoft Access MVP

      >Right now I had to build a report that allowed the people to check for
      >gross outliers in their data input.
      >short I am looking at 2.5* std dev + -
      >
      >anyway I used 2 dummy variables in the query the report is tied to.
      >start date and end date. This pops up an input box for these values
      >and they put in 11/01/08 and 11/31/08 and it runs the report showing
      >the outliers.
      >I watched and everyone is looking at month not date
      >Now I was thinking instead fof this in the query under recDATE
      >
      >>=[start_date] And <=[end_date]
      >
      >is there a way of just asking for a month and year and then comparing
      >the recDATE without day in it?
      >
      >so one check for a new input of CKdate being 11/08
      >
      >Later I might even do something first to ask month or range.

      Comment

      • sparks

        #4
        Re: trying to look at dates

        Ok the datepart worked fine on the month entry.

        When you say criteria form do you mean a form with something like this

        start_date text box
        end_date text box

        button to open the report.
        if you click on the button it will pop up a start_date box for input
        then and end_date box for input.

        can the start_date and end_date be passed to the report instead

        DoCmd.OpenRepor t stDocName, acPreview it has a where and an open args
        that can be passed to the report.

        start_date=text 1.value
        end_date=text2. value
        something like that?

        have to try that it sounds interesting





        On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
        <tom7744.no.spa m@cox.netwrote:
        >Criteria form

        Comment

        • Salad

          #5
          Re: trying to look at dates

          sparks wrote:
          Ok the datepart worked fine on the month entry.
          >
          When you say criteria form do you mean a form with something like this
          >
          start_date text box
          end_date text box
          >
          button to open the report.
          if you click on the button it will pop up a start_date box for input
          then and end_date box for input.
          >
          can the start_date and end_date be passed to the report instead
          >
          DoCmd.OpenRepor t stDocName, acPreview it has a where and an open args
          that can be passed to the report.
          >
          start_date=text 1.value
          end_date=text2. value
          something like that?
          >
          have to try that it sounds interesting
          >
          >
          >
          >
          >
          On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
          <tom7744.no.spa m@cox.netwrote:
          >
          >
          >>Criteria form
          >
          >
          Yes. Create a form that has the data entry fields for the report.
          Docmd.Openform "ReportNameCrit eria"

          You'd have text boxes for your filter on the form and a command button
          to open the report, another to exit. For the Command button to run/open
          the report you'd have some code similar to the aircode below.
          Dim strF As String
          If Not IsNull(Me.TextB oxName1) then
          strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
          Endif
          If Not IsNull(Me.TextB oxName2) then
          strF = strF & _
          "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
          Endif
          ....any other additional filtering that is required

          'now remove the " And " at the end of the filter string
          If strF "" Then strF = Left(strF,Len(s trF)-5)

          Docmd.OpenRepor t "ReportName",,, strF

          You can do the same/similar thing to open a Form

          Things to remember.
          String require quotes
          Dates require #
          Numbers nothing

          "StringFld = '" & TextBoxVal & "'"
          "DateFld = #" & TextBoxVal & "#"
          "NumberFld = " & TextBoxVal

          Comment

          • sparks

            #6
            Re: trying to look at dates

            OK after modifying everything I can think of.
            I have sent these 3 strings to the report

            DoCmd.OpenRepor t stDocName, acPreview, , , strF

            debug.print strF

            Start_date = #11/1/2006# And End_Date = #11/30/2006#
            Start_date = 11/1/2006 And End_Date = 11/30/2006
            Start_date = "11/1/2006" And End_Date = "11/30/2006"


            every one returns type mismatch

            I guess I don't understand what is up

            On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oil@vinegar.co mwrote:
            >sparks wrote:
            >
            >Ok the datepart worked fine on the month entry.
            >>
            >When you say criteria form do you mean a form with something like this
            >>
            >start_date text box
            >end_date text box
            >>
            >button to open the report.
            >if you click on the button it will pop up a start_date box for input
            >then and end_date box for input.
            >>
            >can the start_date and end_date be passed to the report instead
            >>
            >DoCmd.OpenRepo rt stDocName, acPreview it has a where and an open args
            >that can be passed to the report.
            >>
            >start_date=tex t1.value
            >end_date=text2 .value
            >something like that?
            >>
            >have to try that it sounds interesting
            >>
            >>
            >>
            >>
            >>
            >On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
            ><tom7744.no.sp am@cox.netwrote :
            >>
            >>
            >>>Criteria form
            >>
            >>
            >Yes. Create a form that has the data entry fields for the report.
            > Docmd.Openform "ReportNameCrit eria"
            >
            >You'd have text boxes for your filter on the form and a command button
            >to open the report, another to exit. For the Command button to run/open
            >the report you'd have some code similar to the aircode below.
            > Dim strF As String
            > If Not IsNull(Me.TextB oxName1) then
            > strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
            > Endif
            > If Not IsNull(Me.TextB oxName2) then
            > strF = strF & _
            "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
            > Endif
            > ....any other additional filtering that is required
            >
            > 'now remove the " And " at the end of the filter string
            > If strF "" Then strF = Left(strF,Len(s trF)-5)
            >
            > Docmd.OpenRepor t "ReportName",,, strF
            >
            >You can do the same/similar thing to open a Form
            >
            >Things to remember.
            > String require quotes
            > Dates require #
            > Numbers nothing
            >
            > "StringFld = '" & TextBoxVal & "'"
            > "DateFld = #" & TextBoxVal & "#"
            > "NumberFld = " & TextBoxVal

            Comment

            • sparks

              #7
              Re: trying to look at dates


              now I see what is up..
              teach me to cut and paste
              DoCmd.OpenRepor t stDocName, acPreview, , , ,strF
              needed another ,

              now it passes any of them..opens the report and request input of
              Start_Date and End_Date

              I am wondering that since these are dummy variables in the query that
              the report is tied to that it can not pass them to the report to then
              pass them to the query.



              On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sparks@comcast .netwrote:
              >OK after modifying everything I can think of.
              >I have sent these 3 strings to the report
              >
              >DoCmd.OpenRepo rt stDocName, acPreview, , , strF
              >
              >debug.print strF
              >
              >Start_date = #11/1/2006# And End_Date = #11/30/2006#
              >Start_date = 11/1/2006 And End_Date = 11/30/2006
              >Start_date = "11/1/2006" And End_Date = "11/30/2006"
              >
              >
              >every one returns type mismatch
              >
              >I guess I don't understand what is up
              >
              >On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oil@vinegar.co mwrote:
              >
              >>sparks wrote:
              >>
              >>Ok the datepart worked fine on the month entry.
              >>>
              >>When you say criteria form do you mean a form with something like this
              >>>
              >>start_date text box
              >>end_date text box
              >>>
              >>button to open the report.
              >>if you click on the button it will pop up a start_date box for input
              >>then and end_date box for input.
              >>>
              >>can the start_date and end_date be passed to the report instead
              >>>
              >>DoCmd.OpenRep ort stDocName, acPreview it has a where and an open args
              >>that can be passed to the report.
              >>>
              >>start_date=te xt1.value
              >>end_date=text 2.value
              >>something like that?
              >>>
              >>have to try that it sounds interesting
              >>>
              >>>
              >>>
              >>>
              >>>
              >>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
              >><tom7744.no.s pam@cox.netwrot e:
              >>>
              >>>
              >>>>Criteria form
              >>>
              >>>
              >>Yes. Create a form that has the data entry fields for the report.
              >> Docmd.Openform "ReportNameCrit eria"
              >>
              >>You'd have text boxes for your filter on the form and a command button
              >>to open the report, another to exit. For the Command button to run/open
              >>the report you'd have some code similar to the aircode below.
              >> Dim strF As String
              >> If Not IsNull(Me.TextB oxName1) then
              >> strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
              >> Endif
              >> If Not IsNull(Me.TextB oxName2) then
              >> strF = strF & _
              > "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
              >> Endif
              >> ....any other additional filtering that is required
              >>
              >> 'now remove the " And " at the end of the filter string
              >> If strF "" Then strF = Left(strF,Len(s trF)-5)
              >>
              >> Docmd.OpenRepor t "ReportName",,, strF
              >>
              >>You can do the same/similar thing to open a Form
              >>
              >>Things to remember.
              >> String require quotes
              >> Dates require #
              >> Numbers nothing
              >>
              >> "StringFld = '" & TextBoxVal & "'"
              >> "DateFld = #" & TextBoxVal & "#"
              >> "NumberFld = " & TextBoxVal

              Comment

              • Salad

                #8
                Re: trying to look at dates

                sparks wrote:
                now I see what is up..
                teach me to cut and paste
                DoCmd.OpenRepor t stDocName, acPreview, , , ,strF
                needed another ,
                >
                now it passes any of them..opens the report and request input of
                Start_Date and End_Date
                >
                I am wondering that since these are dummy variables in the query that
                the report is tied to that it can not pass them to the report to then
                pass them to the query.
                Actually, you have two extra commas.

                DOcmd.OpenRepor t "RptName","view ","filter","whe re condition","arg uments"

                If you want to preview first...
                DoCmd.OpenRepor t stDocName, acPreview,,strF
                would work better.

                BTW, use the # around the dates if the table fields are type datetime.

                I've never used the "filter" argument in the command line, only the
                "where condition"

                You can pass an argument to the report that is accessable via the
                OpenArgs property. For example...
                Docmd.OpenRepor t "rptname",,,,Me .Name
                and in the OnOpen event (or any report event) enter something like
                msgbox "the calling form name is " & Me.OpenArgs
                >
                >
                >
                On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sparks@comcast .netwrote:
                >
                >
                >>OK after modifying everything I can think of.
                >>I have sent these 3 strings to the report
                >>
                >>DoCmd.OpenRep ort stDocName, acPreview, , , strF
                >>
                >>debug.print strF
                >>
                >>Start_date = #11/1/2006# And End_Date = #11/30/2006#
                >>Start_date = 11/1/2006 And End_Date = 11/30/2006
                >>Start_date = "11/1/2006" And End_Date = "11/30/2006"
                >>
                >>
                >>every one returns type mismatch
                >>
                >>I guess I don't understand what is up
                >>
                >>On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oil@vinegar.co mwrote:
                >>
                >>
                >>>sparks wrote:
                >>>
                >>>
                >>>>Ok the datepart worked fine on the month entry.
                >>>>
                >>>>When you say criteria form do you mean a form with something like this
                >>>>
                >>>>start_dat e text box
                >>>>end_date text box
                >>>>
                >>>>button to open the report.
                >>>>if you click on the button it will pop up a start_date box for input
                >>>>then and end_date box for input.
                >>>>
                >>>>can the start_date and end_date be passed to the report instead
                >>>>
                >>>>DoCmd.OpenR eport stDocName, acPreview it has a where and an open args
                >>>>that can be passed to the report.
                >>>>
                >>>>start_date= text1.value
                >>>>end_date=te xt2.value
                >>>>something like that?
                >>>>
                >>>>have to try that it sounds interesting
                >>>>
                >>>>
                >>>>
                >>>>
                >>>>
                >>>>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
                >>>><tom7744.no .spam@cox.netwr ote:
                >>>>
                >>>>
                >>>>
                >>>>>Criteria form
                >>>>
                >>>>
                >>>Yes. Create a form that has the data entry fields for the report.
                >>> Docmd.Openform "ReportNameCrit eria"
                >>>
                >>>You'd have text boxes for your filter on the form and a command button
                >>>to open the report, another to exit. For the Command button to run/open
                >>>the report you'd have some code similar to the aircode below.
                >>> Dim strF As String
                >>> If Not IsNull(Me.TextB oxName1) then
                >>> strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
                >>> Endif
                >>> If Not IsNull(Me.TextB oxName2) then
                >>> strF = strF & _
                >> "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
                >>> Endif
                >>> ....any other additional filtering that is required
                >>>
                >>> 'now remove the " And " at the end of the filter string
                >>> If strF "" Then strF = Left(strF,Len(s trF)-5)
                >>>
                >>> Docmd.OpenRepor t "ReportName",,, strF
                >>>
                >>>You can do the same/similar thing to open a Form
                >>>
                >>>Things to remember.
                >>> String require quotes
                >>> Dates require #
                >>> Numbers nothing
                >>>
                >>> "StringFld = '" & TextBoxVal & "'"
                >>> "DateFld = #" & TextBoxVal & "#"
                >>> "NumberFld = " & TextBoxVal
                >
                >

                Comment

                • sparks

                  #9
                  Re: trying to look at dates

                  I tried passing the filter and even passed filteron= true on the
                  openargs...
                  after removing the criteria of >=[start_date] And <=[end_date] in the
                  query.
                  I decied to try it and see what happened so then I tried this

                  strF = "[date1]>= " & "#" & Me.text1 & "#" & " And [date1]<= " & "#" &
                  Me.text2 & "#"

                  DoCmd.OpenRepor t stDocName, acPreview
                  Reports![RangeCheck].Filter = strF
                  Reports![RangeCheck].FilterOn = True

                  and it worked.
                  this does not make much since to me but getting it to work was at
                  least a start

                  On Wed, 15 Oct 2008 14:42:21 -0700, Salad <oil@vinegar.co mwrote:
                  >sparks wrote:
                  >
                  >now I see what is up..
                  >teach me to cut and paste
                  >DoCmd.OpenRepo rt stDocName, acPreview, , , ,strF
                  >needed another ,
                  >>
                  >now it passes any of them..opens the report and request input of
                  >Start_Date and End_Date
                  >>
                  >I am wondering that since these are dummy variables in the query that
                  >the report is tied to that it can not pass them to the report to then
                  >pass them to the query.
                  >
                  >Actually, you have two extra commas.
                  >
                  >DOcmd.OpenRepo rt "RptName","view ","filter","whe re condition","arg uments"
                  >
                  >If you want to preview first...
                  > DoCmd.OpenRepor t stDocName, acPreview,,strF
                  >would work better.
                  >
                  >BTW, use the # around the dates if the table fields are type datetime.
                  >
                  >I've never used the "filter" argument in the command line, only the
                  >"where condition"
                  >
                  >You can pass an argument to the report that is accessable via the
                  >OpenArgs property. For example...
                  > Docmd.OpenRepor t "rptname",,,,Me .Name
                  >and in the OnOpen event (or any report event) enter something like
                  > msgbox "the calling form name is " & Me.OpenArgs
                  >
                  >>
                  >>
                  >>
                  >On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sparks@comcast .netwrote:
                  >>
                  >>
                  >>>OK after modifying everything I can think of.
                  >>>I have sent these 3 strings to the report
                  >>>
                  >>>DoCmd.OpenRe port stDocName, acPreview, , , strF
                  >>>
                  >>>debug.prin t strF
                  >>>
                  >>>Start_date = #11/1/2006# And End_Date = #11/30/2006#
                  >>>Start_date = 11/1/2006 And End_Date = 11/30/2006
                  >>>Start_date = "11/1/2006" And End_Date = "11/30/2006"
                  >>>
                  >>>
                  >>>every one returns type mismatch
                  >>>
                  >>>I guess I don't understand what is up
                  >>>
                  >>>On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oil@vinegar.co mwrote:
                  >>>
                  >>>
                  >>>>sparks wrote:
                  >>>>
                  >>>>
                  >>>>>Ok the datepart worked fine on the month entry.
                  >>>>>
                  >>>>>When you say criteria form do you mean a form with something like this
                  >>>>>
                  >>>>>start_da te text box
                  >>>>>end_date text box
                  >>>>>
                  >>>>>button to open the report.
                  >>>>>if you click on the button it will pop up a start_date box for input
                  >>>>>then and end_date box for input.
                  >>>>>
                  >>>>>can the start_date and end_date be passed to the report instead
                  >>>>>
                  >>>>>DoCmd.Open Report stDocName, acPreview it has a where and an open args
                  >>>>>that can be passed to the report.
                  >>>>>
                  >>>>>start_date =text1.value
                  >>>>>end_date=t ext2.value
                  >>>>>somethin g like that?
                  >>>>>
                  >>>>>have to try that it sounds interesting
                  >>>>>
                  >>>>>
                  >>>>>
                  >>>>>
                  >>>>>
                  >>>>>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
                  >>>>><tom7744.n o.spam@cox.netw rote:
                  >>>>>
                  >>>>>
                  >>>>>
                  >>>>>>Criteri a form
                  >>>>>
                  >>>>>
                  >>>>Yes. Create a form that has the data entry fields for the report.
                  >>>> Docmd.Openform "ReportNameCrit eria"
                  >>>>
                  >>>>You'd have text boxes for your filter on the form and a command button
                  >>>>to open the report, another to exit. For the Command button to run/open
                  >>>>the report you'd have some code similar to the aircode below.
                  >>>> Dim strF As String
                  >>>> If Not IsNull(Me.TextB oxName1) then
                  >>>> strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
                  >>>> Endif
                  >>>> If Not IsNull(Me.TextB oxName2) then
                  >>>> strF = strF & _
                  >>> "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
                  >>>> Endif
                  >>>> ....any other additional filtering that is required
                  >>>>
                  >>>> 'now remove the " And " at the end of the filter string
                  >>>> If strF "" Then strF = Left(strF,Len(s trF)-5)
                  >>>>
                  >>>> Docmd.OpenRepor t "ReportName",,, strF
                  >>>>
                  >>>>You can do the same/similar thing to open a Form
                  >>>>
                  >>>>Things to remember.
                  >>>> String require quotes
                  >>>> Dates require #
                  >>>> Numbers nothing
                  >>>>
                  >>>> "StringFld = '" & TextBoxVal & "'"
                  >>>> "DateFld = #" & TextBoxVal & "#"
                  >>>> "NumberFld = " & TextBoxVal
                  >>
                  >>

                  Comment

                  • Salad

                    #10
                    Re: trying to look at dates

                    sparks wrote:
                    I tried passing the filter and even passed filteron= true on the
                    openargs...
                    after removing the criteria of >=[start_date] And <=[end_date] in the
                    query.
                    I decied to try it and see what happened so then I tried this
                    >
                    strF = "[date1]>= " & "#" & Me.text1 & "#" & " And [date1]<= " & "#" &
                    Me.text2 & "#"
                    >
                    DoCmd.OpenRepor t stDocName, acPreview
                    Reports![RangeCheck].Filter = strF
                    Reports![RangeCheck].FilterOn = True
                    >
                    and it worked.
                    this does not make much since to me but getting it to work was at
                    least a start
                    You can filter the reports recordsource or you can pass the filter to
                    the report

                    I prefer doing something like this
                    Select * from orders
                    as the recordsource for the report and then open the report like
                    Docmd.OpenRepor t "RptName",acVie wPreview,,"Orde rNo = 1"

                    Let's say the form to call the report is CallRpt. In the query you
                    could have something like
                    Select * From Orders Where OrderNo = " & Forms!CallRpt!O rderNo
                    and it would search/filter onthe value of the textbox OrderNo in the form.

                    Since you post partial info I can only throw some mud and hope it sticks.

                    What you should try is entering the Docmd.Report and then step thru the
                    options when calling a report as you will be prompted for each argument.

                    >
                    On Wed, 15 Oct 2008 14:42:21 -0700, Salad <oil@vinegar.co mwrote:
                    >
                    >
                    >>sparks wrote:
                    >>
                    >>
                    >>>now I see what is up..
                    >>>teach me to cut and paste
                    >>>DoCmd.OpenRe port stDocName, acPreview, , , ,strF
                    >>>needed another ,
                    >>>
                    >>>now it passes any of them..opens the report and request input of
                    >>>Start_Date and End_Date
                    >>>
                    >>>I am wondering that since these are dummy variables in the query that
                    >>>the report is tied to that it can not pass them to the report to then
                    >>>pass them to the query.
                    >>
                    >>Actually, you have two extra commas.
                    >>
                    >>DOcmd.OpenRep ort "RptName","view ","filter","whe re condition","arg uments"
                    >>
                    >>If you want to preview first...
                    >> DoCmd.OpenRepor t stDocName, acPreview,,strF
                    >>would work better.
                    >>
                    >>BTW, use the # around the dates if the table fields are type datetime.
                    >>
                    >>I've never used the "filter" argument in the command line, only the
                    >>"where condition"
                    >>
                    >>You can pass an argument to the report that is accessable via the
                    >>OpenArgs property. For example...
                    >> Docmd.OpenRepor t "rptname",,,,Me .Name
                    >>and in the OnOpen event (or any report event) enter something like
                    >> msgbox "the calling form name is " & Me.OpenArgs
                    >>
                    >>
                    >>>
                    >>>
                    >>>On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sparks@comcast .netwrote:
                    >>>
                    >>>
                    >>>
                    >>>>OK after modifying everything I can think of.
                    >>>>I have sent these 3 strings to the report
                    >>>>
                    >>>>DoCmd.OpenR eport stDocName, acPreview, , , strF
                    >>>>
                    >>>>debug.pri nt strF
                    >>>>
                    >>>>Start_dat e = #11/1/2006# And End_Date = #11/30/2006#
                    >>>>Start_dat e = 11/1/2006 And End_Date = 11/30/2006
                    >>>>Start_dat e = "11/1/2006" And End_Date = "11/30/2006"
                    >>>>
                    >>>>
                    >>>>every one returns type mismatch
                    >>>>
                    >>>>I guess I don't understand what is up
                    >>>>
                    >>>>On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oil@vinegar.co mwrote:
                    >>>>
                    >>>>
                    >>>>
                    >>>>>sparks wrote:
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>>Ok the datepart worked fine on the month entry.
                    >>>>>>
                    >>>>>>When you say criteria form do you mean a form with something like this
                    >>>>>>
                    >>>>>>start_dat e text box
                    >>>>>>end_dat e text box
                    >>>>>>
                    >>>>>>button to open the report.
                    >>>>>>if you click on the button it will pop up a start_date box for input
                    >>>>>>then and end_date box for input.
                    >>>>>>
                    >>>>>>can the start_date and end_date be passed to the report instead
                    >>>>>>
                    >>>>>>DoCmd.Ope nReport stDocName, acPreview it has a where and an open args
                    >>>>>>that can be passed to the report.
                    >>>>>>
                    >>>>>>start_dat e=text1.value
                    >>>>>>end_date= text2.value
                    >>>>>>somethi ng like that?
                    >>>>>>
                    >>>>>>have to try that it sounds interesting
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
                    >>>>>><tom7744. no.spam@cox.net wrote:
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>>>Criter ia form
                    >>>>>>
                    >>>>>>
                    >>>>>Yes. Create a form that has the data entry fields for the report.
                    >>>>> Docmd.Openform "ReportNameCrit eria"
                    >>>>>
                    >>>>>You'd have text boxes for your filter on the form and a command button
                    >>>>>to open the report, another to exit. For the Command button to run/open
                    >>>>>the report you'd have some code similar to the aircode below.
                    >>>>> Dim strF As String
                    >>>>> If Not IsNull(Me.TextB oxName1) then
                    >>>>> strF = "FldNameToFilte r1 = " & Me.TextBoxName1 & " And "
                    >>>>> Endif
                    >>>>> If Not IsNull(Me.TextB oxName2) then
                    >>>>> strF = strF & _
                    >>>> "FieldNameToFil ter2 = " & Me.TextBoxName2 & " And "
                    >>>>> Endif
                    >>>>> ....any other additional filtering that is required
                    >>>>>
                    >>>>> 'now remove the " And " at the end of the filter string
                    >>>>> If strF "" Then strF = Left(strF,Len(s trF)-5)
                    >>>>>
                    >>>>> Docmd.OpenRepor t "ReportName",,, strF
                    >>>>>
                    >>>>>You can do the same/similar thing to open a Form
                    >>>>>
                    >>>>>Things to remember.
                    >>>>> String require quotes
                    >>>>> Dates require #
                    >>>>> Numbers nothing
                    >>>>>
                    >>>>> "StringFld = '" & TextBoxVal & "'"
                    >>>>> "DateFld = #" & TextBoxVal & "#"
                    >>>>> "NumberFld = " & TextBoxVal
                    >>>
                    >>>
                    >

                    Comment

                    Working...