Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   AddDate function not in report (https://www.askmehelpdesk.com/showthread.php?t=268705)

  • Oct 12, 2008, 09:16 PM
    gwallace1
    AddDate function not in report
    I am attempting to add auser specified number of days to a date rage (Hearing Date) to calculate the end date of a prticular sentence. I use the control source property as :

    =DateAdd("d",[Loss_of_Yard],[Hearing_Date])

    I use the same parameters for each area I need to add the time to. It appears to function perfectly, but does not show the new date in the report I have created. The necessary information is in my query(I think) and the form sourc eis correct for all areas it just will not shoe up in my REPORT. Am I missing something with regards to the DateAdd function on a form? Should it go somewhere else?

    PS.. Loss of date is user specified number 0-360 and is added to the date (Hearing Date). The number totals correctly but as stated, will not reflect in the report. What Am I missing. Any hel is appreciated.
  • Oct 13, 2008, 05:54 AM
    ScottGem

    I've found that putting calcs in reports is often problematic. I try to put them in my queries whenever possible. In addition, I do not like using parameter prompt queries. Instead I prefer to use a form to enter criteria. So I would have an unbound form, with a text box for Loss of Yard, I would then have a column in my query like this:

    EndSentence: DateAdd("d",Forms!formname!txtEOY,[Hearing_Date])

    Where fomname is the name of the form and txtEOY, the name of the control.

    Then bind a control on your report to EndSentence. Add a button on the form to kick off the report.

    By the way, this also has the advantage of making use the user enters a number between 0 and 360. Using a parameter prompt there is no restriction on what number they can enter.



    So you should have a column in your query like this:
  • Oct 13, 2008, 01:00 PM
    gwallace1

    Sorry I was not totally clear... I have a report with the control source set as =DateAdd("d",[Loss_of_Yard],[Hearing_Date])
    The query has no criteria set and the query column for the sum of the variable days added and the "hearing Date" is named TimeTotal. I actually have multiple text boxes on my form that add user defined days to the date "Hearing date" All have a "=DateAdd" function as the control source. Should I not do this and make the query do the math? I have tried that but I can never get the query to give me a total on my form. If you need more info I will get it. Sorry I am sort of new at this... Thanks for your time.
  • Oct 13, 2008, 05:53 PM
    ScottGem

    Again, I always put my calcs in the query wherever prossible. So yes, I think you should put it in the query then just bind a control to it.
  • Oct 20, 2008, 02:41 AM
    gwallace1

    got it thanks... put it in report... with control source as:
    =DateAdd("d",[Loss_of_Yard],[Hearing_Date]). I could not get it to work in query.
  • Oct 20, 2008, 06:43 AM
    ScottGem

    That's weird, but glad you got it working.

  • All times are GMT -7. The time now is 05:52 AM.