Results 1 to 6 of 6
  1. #1
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183

    Need and opinion - Member ID


    What do you think would be the best way to generate a membership ID number? Here is the idea I have. When a new member is added to my member table I have a timestamp. I also have the actual table primary key 'ID'. What I wanted to do was simply join the year part of the timestamp and the record's ID. I'm just having problems creating the query.
    Code:
    member id:[timestamp]& [id]
    Now this works but I don't know how to do two things. How do I extract JUST the year from my timestamp field and how do I add leading zeros to the ID when it generates the member id? So instead of generating an ID that looks like 04042013 17:437 it would look like 20130007. If figure this way, the member id is generated on the fly for reports and print outs and such. Though later, I will need to do searches based on the member's ids and lookups by member ids. Should I use a different method or hardcode their ID into the member's table?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Year([timestamp]) & Format([id], "0000")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    That worked. Thanks.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    Thanks. I'll be here a lot. At least until I finish my home project.

  6. #6
    dniezby is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2013
    Posts
    183
    I tried to use this formula in the same query to add an Age field.

    AGE:Year([dateofbirth])-Year([timestamp]) and the result is correct it's just showing up as a negative number. Also, is it possible to compensate for whether or not the persons birthday has passed or not?

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

Similar Threads

  1. Replies: 4
    Last Post: 04-02-2013, 06:37 AM
  2. Member Check in and out
    By BrianF in forum Programming
    Replies: 1
    Last Post: 02-28-2013, 06:37 PM
  3. Guiding Through Steps (Opinion Please)
    By Dalagrath in forum Forms
    Replies: 1
    Last Post: 04-01-2011, 05:02 PM
  4. Replies: 2
    Last Post: 06-30-2010, 12:26 PM
  5. Looking for quick opinion on simple database
    By Zoran in forum Database Design
    Replies: 6
    Last Post: 01-31-2010, 05:04 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