Results 1 to 8 of 8
  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Single Record Table (Access 2002/2003)

    Is it possible to create a table and restrict it, so that it will contain only one record.

    I think not - but I'd be happy to be proven wrong.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Single Record Table (Access 2002/2003)

    Create a table and add a field ID (Number, Long Integer), plus other fields as needed.
    Make ID the Primary Key of the table, so it must be unique.
    Enter 1 (the number one) in the Validation Rule property of the ID field, and an appropriately annoying error message in the Validation Text property.
    Save the table.
    You can now enter one record, with ID = 1.

  3. #3
    Star Lounger
    Join Date
    Nov 2005
    Location
    Edmonton, Alberta, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Single Record Table (Access 2002/2003)

    If you also set the default for ID to 1 you don't even have to type that value into the record (I know that doesn't save keystrokes for a single table, but might be handy if you use the table as a template for other 1 record tables).

  4. #4
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Single Record Table (Access 2002/2003)

    thanks guys!
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Single Record Table (Access 2002/2003)

    OK you have got my inquisitive hat out of the draw now and got me wondering why you need a table with one record and one record in it only?
    Jerry

  6. #6
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Single Record Table (Access 2002/2003)

    Storing things like Company name and address etc.; settings; maybe even values instead of using global variables in code. Saving values in a one record table allows them to persist from session to session and they do not get lost if your code goes belly-up and resets your globals. I also use it to store the back-end path for re-linking purposes if needed. There are several uses for this technique.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  7. #7
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Single Record Table (Access 2002/2003)

    Thanks Steve, makes sense
    Jerry

  8. #8
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Single Record Table (Access 2002/2003)

    In this db I'm using it to store the dates for the current Pay Period. The user changes the pay period and the time sheet is able to calculate when employees have worked more than 44 hours in a week or 88 hours in the pay period.
    <small>Only somehow they managed to put in TWO pay periods in the table!<small>
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

Posting Permissions

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