Results 1 to 6 of 6
  1. #1
    Corinne is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    Jun 2009
    Posts
    3

    Question Displaying Time Only

    I want to display a suggested time for when an event may have taken place. I thought I could use a date/time field with an input mask of 00:00 and it would capture only those four characters (hh:nn). I created a macro and the .txt file related to my query shows a date of 12/30/1899 followed by the inputted time of 12:15. How do I get rid of the inaccurate and undesired date and show just the 12:15?

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    Use Self-Defined Function

    Code:
    Function HrMin(time1)
        HrMin = Format(time1, "hh:mm")
    End Function

  3. #3
    Corinne is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    Jun 2009
    Posts
    3
    Forgive me - but where do I put that code? and the time1 portion - do I change that to my designated field name?

  4. #4
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    you can put that function in an module or simply on your forms module. Time1 is a variable from your field name in your form or you just hardcoded it inside your code as a variable.

  5. #5
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    Function is a very useful concept you must master.

    Simple function example is :
    sum([sales])
    now()

    You can use it freely in query, form, or report
    eg. HrMin(now()) you get current time's hr and min.

  6. #6
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    By the way, pls be reminded that

    the function code should be put into module in order to make it work for whole database.

    time1 is just a parameter variable that could be changed by you.
    You could put time1 as now() or whatever time you like.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. [Access 2003] Displaying 24 Hour Time
    By Trainman in forum Access
    Replies: 4
    Last Post: 03-18-2009, 06:34 PM
  2. form not displaying fields
    By ashiers in forum Forms
    Replies: 0
    Last Post: 09-19-2008, 07:02 AM
  3. displaying the time 12:00:00 AM
    By kfoyil in forum Access
    Replies: 4
    Last Post: 12-05-2006, 11:02 PM
  4. Displaying a PDF in a Form
    By Chaz in forum Forms
    Replies: 0
    Last Post: 08-07-2006, 03:26 PM
  5. Displaying data formatted
    By Zoroxeus in forum Forms
    Replies: 0
    Last Post: 03-14-2006, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums