Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: How to display a data range to the report

    I have a report base on query that user need enter the start date and end date, Then i would like to show the data range to the report such as :
    8/1/2007 - 8/15/2007. Thanks.

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    How is the user opening the report and inputing the date criteria?

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    As in the query, i use between [Enter the start date] and [Enter the end date] for the date field. So when user open the report, it will show me box asks user to enter the start date and end date.

  4. #4
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Rather than using [Enter criteria] in the query, I would use a form to promt the user for the criteria. You can then reference the form in the query criteria and pass the criteria to the report via openargs.

  5. #5
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    in the date criteria put

    Between forms!myform!field1 and forms!myform!field2
    then place a large textbox at the top of the report

    On the open event of the report simply place the following code:

    me!mytextbox = "Report for ...." & forms!myform!field1 & " thru " & _
    forms!myform!field2

    note: you do not need the undescore at the end of the line if you place all of this on one line of code
    also we are assuming you are going to use the form reference and not the entering of the parameters.

    If you insist on the parameter avenue - you can sort ascending get the first record and last record and those dates are your range for the report title
    Dale Houston, TX

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    me!mytextbox = "Report for ...." & forms!myform!field1 & " thru " & _
    forms!myform!field2
    If that gets implemented I'll cry
    George
    Home | Blog

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Id strongly reccommned that you do not use parameter queries...
    In the past Ive used a central clearing house form (Usually the switchboard or menu form), which allows the user to set values for parameters and then pull those parameters as required into any queries referring to those values in the query criteria as

    Code:
    Between [Forms]![<formname>]![<Startcontrolname>] And [Forms]![frmmain]![<Endcontrolname>]
    .... the reason.. that way round you know you are always supplying known good data to the query (well you ought to be able to guarantee that.. after all its your code), the values are consistent so if the user wants to run a whole series of reports based on the same criteria they don't have to keep entering the dates, its easier for the user to use.. they just enter the values once....
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Mar 2004
    Posts
    660
    Thanks all. I tried the query with no paraters. But a form with two text boxes using txtstartdate and txtenddate. But i want to show those two values to the report. It didn't show up,
    i use the code:
    me!mytextbox = "Report for ...." & forms!myform!field1 & " thru " & _
    forms!myform!field2

    the error message is: you can't assign a value to this object.

    Could you help me? Thanks again!

  9. #9
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    I said I was lazy today
    BTW beer sells better as Lite than it does as Light
    I do alot of development in the SteelDetailing industry as well as POS systems - the steel detailing guys use alot of "shortisms" - I have never been asked to chage the thru - perhaps if it were :threw" that would be a different story.

    With that said Geo - I hope that was what you were referring to. )
    Dale Houston, TX

  10. #10
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Private Sub Form_Open(Cancel As Integer)
    Text0 = "this" & " thru " & "That"

    End Sub
    worked like a charm
    Dale Houston, TX

  11. #11
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    you didn't actually use verbatim what I wrote did you?
    Dale Houston, TX

  12. #12
    Join Date
    Mar 2004
    Posts
    660
    As i use laptop withourt internet. Let me type it:

    Why you use open form event not open report event as i want to show the date range in the report.

    Private Sub Report_Open(cancel as integer)
    me.txtDateRange ="Report for " &Forms!fmReceipt!txtStartDate & "thru " & Forms!fmReceipt!txtEndDate
    End Sub

    It didn't work. I also tried, me.txtDataRange ="Test"
    It also shows the error message.

    Thanks.

  13. #13
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    my mistake was in a hurry - I apologize - for the report use the format event

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Text0.Value = "Hello World"
    Dale Houston, TX

  14. #14
    Join Date
    Mar 2004
    Posts
    660
    I did try. Same error message.

  15. #15
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    are you using a textbox or label?

    the code for the hello world is verbatim from a report - report1 on the onformat of the detail

    which will work with the onformat event of all sections of the report - at least all sections of a report I have used this type of quick hack on.
    Dale Houston, TX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •