Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Sep 2008
    Location
    Virginia, USA
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Parsing date and time from one field without seconds (Access 2007)

    I have one date field that is set to Now() in order to populate automatically when the user enters a record. The report should display both a short date with yyyy, e.g., "6/20/2012" and a time without seconds such as "2:45 PM." I need flexibility in the report as to where the 2 pieces of information are located. How do I accomplish that?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    This is strictly a formatting issue, you don't have to parse the date and time. You may only need to do that if you need to use the results for comparison.

    You can have 2 textboxes on your report, both of which have same date field as the control source. One you format "m/dd/yyyy", the other "h:nn AM/PM"
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Lounger
    Join Date
    Sep 2008
    Location
    Virginia, USA
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Parameters on report for Now()

    Thanks, that worked. One more report issue: My data source for report is "SELECT * FROM [tbl_events] WHERE [xdate] between [From] and [To]. The report has a text box where Control Source = "Activities that occured " & [from] & " through " & [to]


    The user is asked for [from] and [to] parameters, but when m/dd/yyyy dates are entered the expected data are not on the report and the text box on the report says "error." Is this because I'm entering a date with time for a field that includes both? What would be a better approach?

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    Quote Originally Posted by spqapat View Post
    Thanks, that worked. One more report issue: My data source for report is "SELECT * FROM [tbl_events] WHERE [xdate] between [From] and [To]. The report has a text box where Control Source = "Activities that occured " & [from] & " through " & [to]


    The user is asked for [from] and [to] parameters, but when m/dd/yyyy dates are entered the expected data are not on the report and the text box on the report says "error." Is this because I'm entering a date with time for a field that includes both? What would be a better approach?
    The [From] and [To] you enter as query parameters are not available to be used in a the control source of a report. The best approach is to have a form with 2 controls, perhaps txtFromDate and txtEndDate. You can then reference these controls in both the report and in the report's query.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. The Following User Says Thank You to MarkLiquorman For This Useful Post:

    spqapat (2012-06-24)

Posting Permissions

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