Results 1 to 10 of 10
  1. #1
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6

    Increment Field Value

    hi all !



    i have 2 field "CLIENT ID" and "CLIENT CODE". when i post a new record, i want the "CLIENT ID" and "CLIENT CODE" to merge to give me 1 field "CLIENT". the CLIENT CODE should be prompted for eg. THO or BLT and added to the CLIENT ID which will compose of 001 or 002. The CLIENT ID should also increment when each new CLIENT record is posted.

    The example should make things clear.

    CLIENT ID CLIENT CODE CLIENT
    001 THO THO001
    002 THO THO002
    001 BLT BLT001

    it should look up the last CLIENT value and then for the new record just continue on the previous entry.

    Hope it makes sense!
    Thanx!

  2. #2
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    You need to use the Function "DMax" then add one.

    Google "DMax Plus 1" for help.

    If no luck then give it your best then post back with what you have.

  3. #3
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6
    Thanx Rain, i will quickly have a look and get back to you!

  4. #4
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6
    The function will work, but my problem is i need to use the DMAX function to look up for the Max value in a field created in a Query that merged the Client ID and Client Code, so i can't use the Table reference as needed in the DMAX format NR: Nz(DMax("NEWCOL","CLIENT"),0)+1 "NR" will go lookup the Value in the NEWCOL which is the merging of CLient ID and Client COde... but it returns "1" cause the NEWCOL field in the CLIENT table is null... does it make sense?

  5. #5
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    There may be no need to merge.

    Once you have the incremented value you can always show the merged value by concatening the two values in the Query.

    Or if you must store the value which is really of no purpose (Just my opinion) then it could be saved on the Form Before Update Event.

  6. #6
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6
    could you please help me with the coding for that increment field ? i have no idea how to find the latest value and then having it stored in NEWCOL

  7. #7
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6
    im terrible at these detailed coding things...

  8. #8
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    I thought you were doing a good job.

    I need to find a Sample Data Base that I wrote some time ago.

    Will get back to you ASAP.

  9. #9
    Malseun is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    6
    Thanx Rain, no i am just struggling to get my head around it... situation is, we have a current CLIENT database, now we want to post new bills under a new field called CLIENT ID... this field should include the Client's surname (first 3 letters) followed by a autonumbering of 001 , 002 etc. But each time you post for eg, Thomas, it should return THO001 ... then when you post Thomas again, it should return THO002... but then if you post Silver it should return SIL001 ... that is my dilemma... that is what i need... but the coding behind it, makes me go boonkers!!! haha

  10. #10
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    The attached is in 2003.

    Good Luck. It is only a little complicated but I am sure you can work it out.

    Just go to the code and search "Max" to find the applicable code.

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. Date Increment
    By James Tebb in forum Access
    Replies: 1
    Last Post: 04-11-2011, 11:40 AM
  3. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  4. How to Increment A Number Field
    By Advanced in forum Programming
    Replies: 3
    Last Post: 01-27-2010, 02:36 PM
  5. Replies: 2
    Last Post: 12-08-2009, 01:19 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