Results 1 to 4 of 4
  1. #1
    thanosgr is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    56

    validation of unique fields

    Hi, any idea to my following problem

    I have an orderid, ordernumber and date

    ordernumber is unique, starting manually from 1 to infinity , until the date is 31/12/2012, after that ordernumber is resetting to 1 again

    Is it possible?



    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    How are you incrementing this number? Please show the code involved.

  3. #3
    thanosgr is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    56
    Hi again.. what im trying to do is i cannot have the same id within the same date

    Id=1, 2/5/2012
    id=2, 2/5/2012
    id-2, 2/5/2012 ----> error id exists.

    Id=2, 3/5/2012 ----> no problem here, since the date is different

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    You are probably looking for something along the lines of

    dmax("[ID]", "[Tbl_table_name]","[date]=#" & date() & "#")+1

    As a side note, date is a bad choice for a field as it is used elsewhere.
    ID should be something useful like orderID otherwise it will just get confused with every other ID in your database and 30 ID fields, tends to get confusing.

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

Similar Threads

  1. Count Unique Fields and then get Average
    By Kirsti in forum Queries
    Replies: 5
    Last Post: 02-19-2012, 07:25 PM
  2. Creating a unique index on two fields
    By Paul H in forum Database Design
    Replies: 3
    Last Post: 11-03-2011, 10:15 AM
  3. Replies: 2
    Last Post: 10-23-2010, 09:38 AM
  4. Replies: 24
    Last Post: 09-01-2010, 02:09 PM
  5. Unique Values and Boolean Fields
    By Triad in forum Forms
    Replies: 1
    Last Post: 07-15-2010, 06:28 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