Results 1 to 2 of 2
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    OnClick increase number in field on form

    I have a field named "BoxNumber" and my first number is "M00001".



    I would like for the field to auto populate with this number until I click a button named "newbox"; then
    I would like the new number "M00002" to auto populate until I click the button again for the next box.
    Each time I click the button it should increase the box number by 1.

    Is this possible?
    thanks,
    Lisa

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,528
    Code:
    on click,
    
    dim iNum as integer
    dim vLast ,vNewNum
    
    vLast = mid(BOXNUMBER,2)
    iNum = vLast + 1
    vNewNum = "M" & format(iNum,"00000")
    
        'new record
    DoCmd.GoToRecord , , acNewRec
    BOXNUMBER = vNewNum

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

Similar Threads

  1. Replies: 4
    Last Post: 04-21-2014, 12:54 AM
  2. Replies: 6
    Last Post: 01-28-2014, 11:44 AM
  3. Replies: 6
    Last Post: 01-24-2013, 10:02 PM
  4. Increase Size of Field Name
    By tonere in forum Database Design
    Replies: 5
    Last Post: 06-27-2011, 02:30 PM
  5. Increase number by 1
    By elstiv in forum Queries
    Replies: 2
    Last Post: 05-14-2011, 12:25 AM

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