Results 1 to 2 of 2
  1. #1
    frevilla is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    1

    Post Autofill field based on autonumber field

    Hello

    I have an add-only form that has an autonumber field. This autonumber gets a new number once you fill any other field on the form.
    I need to have on the same form an autofill field that has the autonumber included on it, besides other data from the same form.
    This autofill field should be stored on a table.

    Let's say
    1. Opened Form
    2. Autonumber populated once I type on any field (ie 5623)
    3. Autofill field empty but once ?I click on it? I get this:
    DCA/TX-09-5623 (This field should be stored on a table)
    where:
    'DCA/TX' is the department I work for (combo box on form)
    '09' is the last two digits of the current year (date on form)
    '5623' is the autonumber given by MS Access

    The objective is to generate a code name on things that come to the departments based on Access autonumber feature.

    Thank you in advance for your help!

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    You need to concatenate the various fields. I would do this in a public function behind the form and then call it on the AfterUpdate of each field and OnCurrent of the form. The code would be something like this:

    Me!AutofillField = Me!DepartmentField & "-" & Right(DatePart("yyyy", Me!DateField), 2) & "-" & Me!AuotnumberField

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

Similar Threads

  1. Customizing the Autonumber field
    By wasim_sono in forum Access
    Replies: 3
    Last Post: 10-24-2014, 03:00 PM
  2. Total based on Formula based on field value
    By cjbuechler in forum Reports
    Replies: 15
    Last Post: 07-10-2009, 09:56 AM
  3. Select a certain field of a record based on ID
    By cesarone82 in forum Access
    Replies: 3
    Last Post: 06-06-2009, 01:16 PM
  4. query - criteria based on another row field value
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 05-29-2009, 04:17 PM
  5. Problems with autonumber field in a form
    By admaldo in forum Forms
    Replies: 0
    Last Post: 02-25-2008, 11:09 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