Results 1 to 7 of 7
  1. #1
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138

    Want to add buttons to go one record higher

    I do have about 14 textboxes inputs.

    On one of them I always put in a number "5421MAG2110 eg. The last 4 numbers can change every time, If I put in one tape for 12/01/2016 it will go to next number, If I put in 4 tapes to same date in will use the same number for all 4.

    I want to put a plus 1 and keep same buttons on my form, so when I press plus 1 button, it must get the last record number from my table and add a number 1 higher that the one in the table.

    I do not know how to do this, is there a sample on how to do this.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Code:
    Sub btnAdd_Click()
    Dim vNum 
    
    VNum = Dlookup("[num","table","[date]=#" & txtDate & "#")
    vNum = vNum + 1
    
    txtCounter = vNum
    end sub

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Your 'number' includes alphas. This will require code to parse the string to extract the numeric sequence, increment, then rebuild the string.

    Generating custom unique identifier is a common topic. Start with:
    https://www.accessforums.net/forms/a...ing-23329.html
    https://www.accessforums.net/databas...try-21975.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.

  4. #4
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    ranman256, thank you, but I only put the date in later,so I need it to do the following

    Get the last record (StickerNumber) from table (Tapes) and then put it in the input textbox (StickerNumber) when I press button (+1) to put number in +1, or button (same) do not add extra number in)

    Hope you understand what I need. If you need I can send you a sample of my file.

    I have tried this, but is says I missing ),], or item in query expression '[stickernumber]'.


    Private Sub addnumber_1_Click()
    Dim vNum
    vNum = DLookup("[StickerNumber", "Tapes", "[stickernumber]=#" & StickerNumber & "#")
    vNum = vNum + 1

    txtCounter = vNum
    End Sub

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Did you review the links in post 3?
    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.

  6. #6
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Yes I did, but it does not look what I need

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    It should be relevant and give you basic code constructs to adapt for your situation.
    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.

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

Similar Threads

  1. How to Get Data to Override Higher Amounts
    By ns8069 in forum Database Design
    Replies: 1
    Last Post: 01-28-2015, 02:46 PM
  2. Replies: 2
    Last Post: 04-25-2014, 11:09 AM
  3. Replies: 5
    Last Post: 06-04-2012, 11:55 AM
  4. Replies: 4
    Last Post: 05-08-2012, 08:07 AM
  5. Replies: 0
    Last Post: 08-19-2008, 11:12 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