Results 1 to 3 of 3
  1. #1
    Beppe is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    33

    Progressive number generator

    Hello everyone!



    My issue regards the generation of a progressive number (pn) for a filename, which is produced thanks to a mask which I'm working on; the mask output is a filename for the new files to be saved.
    The pn should be generated through a button or something similar that reads the files in a given directory.
    The pn should therefore be produced by taking into account the other fields of the filename, and add 1 when finds the same fields. Follows an example:

    The filename is COM-CE7001AR0-N049-DAMMER-XXXX-XXXXXX-CAROPRESEX-170130-XXXX-XXXXXX-001-PASSIR-ACCE.

    Let's hypothesize that all fields are the same for the new filename to be produced except for the pn that should be 002 (pn is the third field starting from right, 001, and exists also in the second field starting from left, CE7001AR0). By clicking on the button is should be generated therefore 002.

    Any idea?

    Thanks in advance
    Beppe

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Could possibly use autonumber field to generate this identifier and then format it with the leading zeros. An identifier with only 3 digits won't have a long life - only 999 records.

    Generating custom unique identifier is a common topic.
    Last edited by June7; 09-19-2017 at 11:14 AM.
    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.

  3. #3
    baderms is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    8
    I'm assuming that the fifth file in the folder would then be 005? If so I would write a function that returns the number of files in the specified folder and add 1 to that to use in creating the new file name.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-31-2016, 07:59 AM
  2. Randon Number Generator
    By DallasW in forum Queries
    Replies: 2
    Last Post: 09-22-2015, 10:40 AM
  3. Rnd function error (Random Number generator)
    By SiciliandoBlue in forum Access
    Replies: 11
    Last Post: 09-02-2015, 03:06 AM
  4. random number generator
    By scottdg in forum Programming
    Replies: 22
    Last Post: 05-12-2015, 01:36 PM
  5. Number generator without Autonumber?
    By Megood in forum Programming
    Replies: 7
    Last Post: 07-19-2012, 08:02 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