Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How To Properly Define A Time Filed? (A2k (9.0.3821) SR-1)

    I need a time field to look like 12: 30 PM on a form. (Hours, Minutes and AM or PM)

    Time in the table is defined Date/Time, Medium Time, 09:00 >LL;0
    Time in the form is defined Medium Time, 09:00 >LL;0

    When I tab through the time field it looks like this 12:30 PM
    When I click the mouse in the time field it looks like this 12:30:15 PM

    How do I get rid of the seconds displaying?

    Thanks, John

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: How To Properly Define A Time Filed? (A2k (9.0.3821) SR-1)

    Try changing the field in the table to short time, and the format on the form to :
    hh:nn AM/PM
    Regards
    John



  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How To Properly Define A Time Filed? (A2k (9.0.3821) SR-1)

    Hi John,

    The only way I've been able to come up with something that works is to place an unbound text box over the "time field" with the following in the control source:

    =Format([txtYourTimeFld],"Medium Time")

    Unfortunatly it still shows the contents of the underlying field if you tab through the fields, but it don't with the mouse... and if you want to edit it you can't <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How To Properly Define A Time Filed? (A2k (9.0.3821) SR-1)

    Hi John

    You suggestion worked, however I had to change my form time control default value to:

    =Format(Time(),"hh:nn a/p")

    Thanks, John

    PS: How do other developers define time fileds, with date/time or string?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How To Properly Define A Time Filed? (A2k (9.0.3821) SR-1)

    There isn't really any such things as a time field, which is part of the problem you're having. No matter what you enter, if the field's datatype is date/time, then your field has both, although the date is a default value which is nonsense. You might find it easier to store the times as strings and then use a conversion function to convert them to date/times when you need to.
    Charlotte

Posting Permissions

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