Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2009
    Posts
    10

    Unanswered: Using mmm-yy as primary key

    Hello everyone,

    I want to create a set of tables that will hold fairly simple monthly HR data. There will be tables for different directorates/data type within the organisation.

    Is it possible to reliably use the month/year as the the primary key (in format 'May-09')? This will allow queries to be run across different tables in order to make comparisons between directorates, time periods, etc.

    When I initially attempted to do this, Access wouldn't retain an entered month from the past, i.e. it replaced it with the current date.

    Many thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Yes, using that as part of the PK (probably first column - depends on queries) is fine. Is this a datetime column that you've set the format for, or is it text?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2009
    Posts
    10
    Still at the planning stage, so nothing set in stone yet. To run queries based on the monthly data, it should be formated as date/time (month/year)?

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Access has some "helpful" stuff that muddies the water.
    Can I just confirm - the column is date\time datatype? And you have set the format to month\year, correct?
    What sort of queries will you run? Just for a specific month? Or comparing matching months year on year? Or comparing this month with last? (and so on)
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Apr 2009
    Posts
    10
    At the moment I am thinking of date/time column in month/year format. Queries maybe an average over a period of time, ie mre than one month, or various comparisons.

    Thanks.

  6. #6
    Join Date
    Aug 2003
    Location
    Bulgaria, Plovdiv
    Posts
    36
    In my humble oppinion I would't dare to use anything different from Long Int as primary key.

  7. #7
    Join Date
    Mar 2009
    Location
    New York
    Posts
    7
    I would never, ever use a date as a PK. That is my dos centos.

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Holy sh*t.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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