Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Inputs printed on Report

BigPete85BigPete85 Member Posts: 30
[b][red]This message was edited by BigPete85 at 2006-6-16 14:40:14[/red][/b][hr]
i generate a report from a query that requires the user to input 2 date ranges. How do i get the report to show these dates from the inputbox into the textboxes on the report?

I guess what im asking is how do i get those values from the inputbox to show up on the report.



Comments

  • dokken2dokken2 Member Posts: 532
    : [b][red]This message was edited by BigPete85 at 2006-6-16 14:40:14[/red][/b][hr]
    : i generate a report from a query that requires the user to input 2 date ranges. How do i get the report to show these dates from the inputbox into the textboxes on the report?
    :
    : I guess what im asking is how do i get those values from the inputbox to show up on the report.
    :
    :
    :
    :
    couple of ways-

    #1
    on the report add a textbox and set the ControlSource property to be
    =[StartDate]
    in the report RecordSource/query add a field for a parameter
    Expr1: [StartDate]

    the value input in the query will populate the report textbox.

    #2
    add a textbox to both a form and the report, in the report set the textbox ControlSource property to equal the forms textbox
    =Forms!form10!text0

    the report will get the value from the form.

    #3
    on the report add a Label and then open the reports code, can set the label caption in the report-open event-

    Option Compare Database

    Const MyValue = "12345"

    Private Sub Report_Open(Cancel As Integer)
    Me.Label1.Caption = MyValue
    End Sub

  • BigPete85BigPete85 Member Posts: 30
    : : [b][red]This message was edited by BigPete85 at 2006-6-16 14:40:14[/red][/b][hr]
    : : i generate a report from a query that requires the user to input 2 date ranges. How do i get the report to show these dates from the inputbox into the textboxes on the report?
    : :
    : : I guess what im asking is how do i get those values from the inputbox to show up on the report.
    : :
    : :
    : :
    : :
    : couple of ways-
    :
    : #1
    : on the report add a textbox and set the ControlSource property to be
    : =[StartDate]
    : in the report RecordSource/query add a field for a parameter
    : Expr1: [StartDate]
    :
    : the value input in the query will populate the report textbox.
    :
    : #2
    : add a textbox to both a form and the report, in the report set the textbox ControlSource property to equal the forms textbox
    : =Forms!form10!text0
    :
    : the report will get the value from the form.
    :
    : #3
    : on the report add a Label and then open the reports code, can set the label caption in the report-open event-
    :
    : Option Compare Database
    :
    : Const MyValue = "12345"
    :
    : Private Sub Report_Open(Cancel As Integer)
    : Me.Label1.Caption = MyValue
    : End Sub
    :
    :

    That only works for one input. I have two input boxes that pop up in a query i have the Month field with the criteria

    Between [Please Enter First Date Range ( dd/mm/yyyy)] And [Please EnterSecond Date Range (dd/mm/yyyy)]

    Which allows the user to input 2 different dates and print out the date ranges between the two. I am however having trouble trying to show the two dates inputed and printed onto the report. When i set a textbox control source to the month field, it only grabs whatever the first date entered was and does nothing with the second date.

  • dokken2dokken2 Member Posts: 532
    : That only works for one input. I have two input boxes that pop up in a query i have the Month field with the criteria
    :
    : Between [Please Enter First Date Range ( dd/mm/yyyy)] And [Please EnterSecond Date Range (dd/mm/yyyy)]
    :
    : Which allows the user to input 2 different dates and print out the date ranges between the two. I am however having trouble trying to show the two dates inputed and printed onto the report. When i set a textbox control source to the month field, it only grabs whatever the first date entered was and does nothing with the second date.
    :
    :
    you can scale up the code to any number of fields, add Textbox1 and Textbox2 for the start and end dates. add textboxes and code to handle each parameter the user inputs.

    i have reports that show the start/end dates plus textboxes that indicate reports filters, ie: department number, retired, transferred, promoted, etc.
  • BigPete85BigPete85 Member Posts: 30
    : : That only works for one input. I have two input boxes that pop up in a query i have the Month field with the criteria
    : :
    : : Between [Please Enter First Date Range ( dd/mm/yyyy)] And [Please EnterSecond Date Range (dd/mm/yyyy)]
    : :
    : : Which allows the user to input 2 different dates and print out the date ranges between the two. I am however having trouble trying to show the two dates inputed and printed onto the report. When i set a textbox control source to the month field, it only grabs whatever the first date entered was and does nothing with the second date.
    : :
    : :
    : you can scale up the code to any number of fields, add Textbox1 and Textbox2 for the start and end dates. add textboxes and code to handle each parameter the user inputs.
    :
    : i have reports that show the start/end dates plus textboxes that indicate reports filters, ie: department number, retired, transferred, promoted, etc.
    :

    How do i grab the second inputbox's value? on the report i have the one text box control source set to the query field "Month" but it only grabs the first date entered.

  • dokken2dokken2 Member Posts: 532
    : : : That only works for one input. I have two input boxes that pop up in a query i have the Month field with the criteria
    : : :
    : : : Between [Please Enter First Date Range ( dd/mm/yyyy)] And [Please EnterSecond Date Range (dd/mm/yyyy)]
    : : :
    : : : Which allows the user to input 2 different dates and print out the date ranges between the two. I am however having trouble trying to show the two dates inputed and printed onto the report. When i set a textbox control source to the month field, it only grabs whatever the first date entered was and does nothing with the second date.
    : : :
    : : :
    : : you can scale up the code to any number of fields, add Textbox1 and Textbox2 for the start and end dates. add textboxes and code to handle each parameter the user inputs.
    : :
    : : i have reports that show the start/end dates plus textboxes that indicate reports filters, ie: department number, retired, transferred, promoted, etc.
    : :
    :
    : How do i grab the second inputbox's value? on the report i have the one text box control source set to the query field "Month" but it only grabs the first date entered.
    :
    :
    you would need a 2nd textbox. and you query needs two parameter values, one for a [start] date and one [end] date. it would not work if you use the Between clause - Date- Between start and end
  • John GachuiJohn Gachui Member Posts: 1
    [b][red]This message was edited by John Gachui at 2006-6-30 0:0:58[/red][/b][hr]
    : : : : That only works for one input. I have two input boxes that pop up in a query i have the Month field with the criteria
    : : : :
    : : : : Between [Please Enter First Date Range ( dd/mm/yyyy)] And [Please EnterSecond Date Range (dd/mm/yyyy)]
    : : : :
    : : : : Which allows the user to input 2 different dates and print out the date ranges between the two. I am however having trouble trying to show the two dates inputed and printed onto the report. When i set a textbox control source to the month field, it only grabs whatever the first date entered was and does nothing with the second date.
    : : : :
    : : : :
    : : : you can scale up the code to any number of fields, add Textbox1 and Textbox2 for the start and end dates. add textboxes and code to handle each parameter the user inputs.
    : : :
    : : : i have reports that show the start/end dates plus textboxes that indicate reports filters, ie: department number, retired, transferred, promoted, etc.
    : : :
    : :
    : : How do i grab the second inputbox's value? on the report i have the one text box control source set to the query field "Month" but it only grabs the first date entered.
    : :
    : :
    : you would need a 2nd textbox. and you query needs two parameter values, one for a [start] date and one [end] date. it would not work if you use the Between clause - Date- Between start and end
    :
    :
    : You could-:
    1. create a dialog form e.g.: form1 with unbound text box controls to
    capture each of the criteria required e.g: start date, stop date
    etc.call these start_date and stop_date repectively.
    2. add two buttons to the form "print" and "close" using the button
    creating wizard on the toolbox
    3. Before the docmd.openreport statement add the statement
    me.visible=false. This will hide the dialog box without closing
    it. This will prevent it from covering the report output if you
    choose preview mode for the docmd.openreport arguements.
    4. Open the reports recordsource query put
    >= forms![form1].[start_date]
    in the criteria row of start
    and
    <= forms![form1].[stop_date]
    for the stop criteria
    5. In the desired report insert two unbound text box controls; startx
    and stopx. In the format event procedure for the report section
    add:
    [startx]=forms![form1].[start_date]
    and
    [stopx]=forms![form1].[stop_date]
    6. In the close event insert a macro to close form1

    This approach can be used for as many runtime user defined report criteria as is needed.

    End
    :
    :
    :




Sign In or Register to comment.