Results 1 to 6 of 6
  1. #1
    johnbchron is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2020
    Posts
    4

    Post Auto-populate autonumber primary key in form

    Heyo everyone I thank you in advance for helping me.

    So I have a table which has an autonumber field as the primary key. There is another field which the user has to manually enter that uses the value of that autonumber field plus some other information (yes I know that autonumber fields shan't be used in this way. I know that this is by far not the optimal solution, but I cannot change it. I just can't). We have a form in which there is a field that corresponds to the autonumber column, but that doesn't populate/isn't assigned until after the record is saved (it just displays "(New)"). I need that to populate when the user goes to make a new record, not after it's saved. Does anybody know of a way to do this? I'm fine with writing code to get this done.

    Sorry for the disorganized thoughts,



    EDIT: The list that the form is operating off of is hosted in sharepoint, so I think that's what's causing this

    -John Lewis
    Last edited by johnbchron; 07-29-2020 at 03:53 PM.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Actually the Auto number is populated as soon as the record is made dirty
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    johnbchron is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2020
    Posts
    4
    Yes, but the field which contains the autonumber changes from containing "(New)" to containing nothing. I need the user to be able to see that value, so maybe with some code I could add register an OnDirty event that refreshes that field with its actual value? (I have no idea how access' VB works)

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    That is not correct. The Auto Number is displayed as soon as any field in the record has a value typed into it. If your db behaves differently, please post a copy for us to play with 😀

  5. #5
    johnbchron is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2020
    Posts
    4
    I'll have to check but I don't think I can post the DB bc of security concerns. I totally forgot to mention however that the table that this form is working off of is a linked table, with the actual table being hosted in sharepoint. Don't know how I missed mentioning that... sorry.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I'm sorry, but I don't do sharepoint.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 3
    Last Post: 06-08-2020, 10:37 AM
  2. Tables and Primary Key autonumber
    By snoop832 in forum Access
    Replies: 5
    Last Post: 11-28-2016, 09:11 AM
  3. Primary key auto populate in form
    By kets0985 in forum Forms
    Replies: 3
    Last Post: 07-22-2015, 10:28 AM
  4. Primary Key Autonumber
    By data808 in forum Access
    Replies: 19
    Last Post: 07-15-2014, 06:51 AM
  5. Sequential autonumber primary key
    By JackCampion in forum Access
    Replies: 0
    Last Post: 09-17-2012, 05:07 PM

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