Results 1 to 2 of 2
  1. #1
    bio_guy is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2016
    Posts
    1

    Automatically fill in sequential numbering for a data field within a subform

    Greetings,



    I'm entering data into a form with two associated subforms. One of the subforms is in a data table layout (if that matters), and I'd like get one of the data fields (numeric) to automatically populate in sequential numbers, specifically 1-50 (in 50 data rows/records), and then after 50, start over again at 1. This is similar to simply using an Autonumber field, however autonumber doesn't allow you to reset it back to 1 after reaching a specific value, in this case 50.

    For more context, I'm a biologist working with vegetation sampling data collected using a line-point intercept method. For a given location (location is my primary key), there are two transects (i.e. lines) that have 50 data points associated with each of these transect lines. Each of the two transects has a label field "Transect ID", which can be one of two values- "Transect 1" or "Transect 2", and for each transect there are 50 "points" where data were collected, in a data field called "Point", and I'd like to have data records for the "Point" field auto fill sequentially 1 through 50 for each unique Transect ID.

    Thanks for your help!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Concept:

    Use a loop such as
    Code:
    for I = 1 to 50
     create a record PointField = I
    next I
    If you want to do this multiple times, put that loop inside another loop

    eg Let's say you want to make 8 sets of records each with 50 records


    Code:
    For TransectLine = 1 to 8
       for I = 1 to 50
            create a record PointField = I
       next I
    Next TransectLine

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

Similar Threads

  1. Subform won't automatically fill.
    By IncidentalProgrammer in forum Forms
    Replies: 2
    Last Post: 01-22-2015, 12:45 PM
  2. Automatically fill in field in a loop
    By RachelBedi in forum Forms
    Replies: 3
    Last Post: 10-24-2012, 12:40 PM
  3. Replies: 5
    Last Post: 10-15-2012, 12:18 AM
  4. Sequential Numbering in a Form
    By Falafa in forum Forms
    Replies: 6
    Last Post: 10-05-2012, 08:20 AM
  5. Help with Sequential Numbering
    By orion in forum Programming
    Replies: 3
    Last Post: 07-06-2009, 01:41 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