Results 1 to 2 of 2
  1. #1
    deadpc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    1

    Create a sequence number based on field value changes

    I am trying to create a sequence number that will count up by 1 based on the selection of a combo box. My table looks like this. Named Table1

    IRType EDate IR_No
    CA 3/1/14 1


    CA 3/6/14 2
    CI 3/7/14 1
    PA 3/7/14 1
    CI 3/8/14 2
    CA 3/8/14 3
    PA 3/9/14 2

    So every time an IRType selection is made on data entry form the IR_NO populates with the next corresponding number. I have tried the following code but can not seem to get it to work.

    Private Sub Form_Click()

    If Me.IR_No = 0 Or IsNull(Me.IR_No) Then

    MeIR_No = Nz(DMax("IR_No", "Type", "Table1"), 0) + 1

    End If

    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why is this needed?

    Generating custom unique identifier is a common topic in forum.

    Alternatively, textbox in report has RunningSum property that can be used to calculate this sequence for each IRType group.
    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. Replies: 7
    Last Post: 04-21-2014, 12:26 PM
  2. Replies: 1
    Last Post: 04-01-2014, 01:38 PM
  3. Replies: 16
    Last Post: 06-20-2013, 09:25 AM
  4. Replies: 2
    Last Post: 06-06-2012, 09:35 AM
  5. Replies: 2
    Last Post: 11-21-2011, 10:48 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