Results 1 to 4 of 4
  1. #1
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69

    Auto-increment fields update

    Hai,
    I have a transaction table and two corresponding forms for receipts and issues in MS Access 2010. Records are either "Receipt" or "Issue". I want to have an automatic update, (incremented by one) on "Receipt No" and "Issue No" fields (both are numeric, double) whenever I add a new record to this table. I mean when I add a new record of Receipt, Receipt No field should give the next sequence number and the same with issue records. I cant use autonumber because both are in one table. Is there any way I can use macro or vb code in the form/field events?
    Thank you in advance for your valuable advise.
    Best regards

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Common topic. Search forum and Google.

    Check this recent thread: https://www.accessforums.net/access/...ber-20506.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by rkalapura View Post
    Hai,
    I have a transaction table and two corresponding forms for receipts and issues in MS Access 2010. Records are either "Receipt" or "Issue". I want to have an automatic update, (incremented by one) on "Receipt No" and "Issue No" fields (both are numeric, double) whenever I add a new record to this table. I mean when I add a new record of Receipt, Receipt No field should give the next sequence number and the same with issue records. I cant use autonumber because both are in one table. Is there any way I can use macro or vb code in the form/field events?
    Thank you in advance for your valuable advise.
    Best regards
    There are many ways to "roll-your-own" Autonumber primary key(s). Here is a link to a Rogers Access Library example:

    http://www.rogersaccesslibrary.com/forum/topic395.html

    or read this:

    http://www.pcreview.co.uk/forums/cus...-t3726793.html

  4. #4
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69
    Thanks for your help. I refered Rogers Access Library examples. Actually I tried to use Max() function before, but it doen't workout. But after getting your help, I used Dmax() function in the default value and the problem solved.
    Thank you once again for your help

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

Similar Threads

  1. Auto Increment Reset
    By Sibtain in forum Programming
    Replies: 3
    Last Post: 10-25-2012, 01:59 AM
  2. Auto update fields in the same table?
    By WendyCha in forum Access
    Replies: 0
    Last Post: 07-07-2011, 12:11 PM
  3. Help with auto update of fields in form
    By u0909098 in forum Forms
    Replies: 1
    Last Post: 05-12-2011, 07:16 AM
  4. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  5. Auto-increment for non-100% numerical fields
    By supernoob in forum Access
    Replies: 0
    Last Post: 05-03-2007, 09:44 PM

Tags for this Thread

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