Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    68

    Unanswered: Date/Time field problem

    I am creating a timekeeping database that will be used to track time spent on a project. I have a form that allows a user to enter a date, select a project/task and enter the number of hours worked. The table that stores this information uses the date and project fields as the primary key.

    How do I get the date field to not list or contain a time as part of the field. I only want one entry for a project/task per day. I set the Date/Time field to "short date", but that doesn't do it.

    The form is in datasheet view (if this helps diagnose the problem.)

    Thank you for your help,
    Grace

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    insert into tableA values (#mm/dd/yyyy#)
    Attached Thumbnails Attached Thumbnails image.JPG  
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Mar 2004
    Posts
    68

    The time still is part of the value???

    I do insert that value, but it automatically attaches a time to the value, that is my problem. I do not want the time attached because it makes the primary key unique.

    Hope this helps define the questions.

    Thank you

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you don't have a problem, you have a fact of life.

    access' date-type ALWAYS has a time: if you set a date-type using just day, month, year you get and will always get a time 00:00:00 appended.

    reason: the date-type is a double. before the decimal is days, after the decimal is fractions-of-a-day. 320 is 320 days, zero hours, zero minutes, zero seconds.

    if you don't want to see the time-part, use format$() when you display.

    izy

    AFTERTHOUGHT ...and as long as you set up the date using just day, month, year, your unavoidable time will ALWAYS be 00:00:00 so all 21st of September's in 2004 will be identical
    Last edited by izyrider; 06-25-04 at 12:34.
    currently using SS 2008R2

  5. #5
    Join Date
    Mar 2004
    Posts
    68

    Date/Time Field problem

    Where are you saying to put the format$()? On the "Date" field properties somewhere? Are you saying that there's no way to have the date field just have a date value without a time? How can you then use it as a primary key where you only want to have one value entered per day?

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    yes, precisely, you CANNOT have a date-type that does not have a time.

    but, you can guarantee that your date ALWAYS has a time of 00:00:00 thus preserving the uniqueness of your datetime.

    use this to setup your dates... not only does it guarantee that all your dates will have time 00:00:00, but it may also be helpful if you play SQL games.

    izy
    currently using SS 2008R2

Posting Permissions

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