Results 1 to 6 of 6
  1. #1
    dgutsche is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    35

    Question Auto Generating a String Using Record Position in Subform

    Hi there

    I have a parent form with a field 'Ticket' which includes a subform. I want to force one of the fields in the subform to autogenerate based upon the 'Ticket' in the parent form and the relative position of the record in the subform. Basically when a person types in 1600 in the parent form field I want at that moment for the subform to populate 1600A, 1600B, 1600C... for all records in the subform.



    I don't know if I should be using the Table.PositionOf function and do some logic to not count other tickets in the table, or if there is a more direct way to reference the position just within the subform itself - Maybe using a number to letter calculation based on an auto-generated field in the second table?

    Thanks!

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Is this field a Combo? Use the AfterUpdateEvent and then code for the autofill. Example:

    Me.ShipCity = ShipZIPCode.Column(2) ' Combo Box Example.
    HTH

  3. #3
    dgutsche is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    35
    I'm unsure if I needed to go the route of making it a Combobox - this little piece of information is going to be a static identifier for the technicians in their paper work and on their lab samples. I just want it to generate the form this way as we always number by this convention. It'll save the clerk from manually typing in sample identifiers. The whole point of the database is to expedite paperwork.

    So is this kind of code something that I would be able to tweak for an expression builder? Pretty novice here. Experienced with VBA and Excel and now I'm trying to learn how to do similar tasks with a database.

    Thanks burrina!

  4. #4
    dgutsche is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    35
    Quote Originally Posted by burrina View Post
    Is this field a Combo? Use the AfterUpdateEvent and then code for the autofill. Example:
    Anyone have an example of how this has been done? Feeling really inept right now ha ha.

    I'm currently trying to set it up and have no problem calling ticket number or concatenating text together. I just need to know how to make it generate the A, B, C, D, E for the subform without jumping to the next letter in the Cylinder table (to which the subform is adding records).

  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,929
    Generating custom unique identifier is fairly common topic. Here is one 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.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    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. Auto multi-level position numbering!!!!
    By joe55555 in forum Access
    Replies: 4
    Last Post: 11-04-2013, 02:14 AM
  2. Scroll Bar position with a subform
    By pelicanbuyer in forum Forms
    Replies: 2
    Last Post: 05-22-2013, 02:46 PM
  3. Insert a new record in a particular position in a table?
    By accessorizer in forum Programming
    Replies: 7
    Last Post: 04-07-2012, 04:21 PM
  4. Get position of record in continuous form
    By Whizbang in forum Forms
    Replies: 3
    Last Post: 11-02-2011, 01:47 PM
  5. Replies: 7
    Last Post: 04-27-2010, 10:29 AM

Tags for this Thread

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