Results 1 to 4 of 4
  1. #1
    SteveApa is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    84

    forms: Force sql server to create autonumber

    Hi.
    I have a form with recordset on sql server. Once the form is populated, I have a vb macro button to close the form. When the form is closed, it seems that that is when autonumber is created. But, before close, I want to use the "Not yet created" autonumber and use it to write a history change table with the same autonumber. How can I force sql server autonumber to be created before I close the form??


    me.recordset.SaveNewlyCreatedRecord

    I tried:
    Me.recordset.update (Me being the form before close)
    Me.recordset.movenext (thinking if I move next, the previous will be created)
    Me.recordset.addnew (thinking this would create the autonumber on the field
    docmd.gotorecord,"",acNewRec...

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Me.Dirty = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    SteveApa is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    84
    AWSOME! Thanks. How Do I mark it as solved?
    Harrisburg, PA

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help! You mark it via the Thread Tools dropdown at the top of the thread.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Create a list with no Autonumber
    By charly.csh in forum Access
    Replies: 8
    Last Post: 09-08-2019, 05:15 PM
  2. Autonumber field in forms
    By Lukael in forum Forms
    Replies: 14
    Last Post: 11-06-2013, 10:50 AM
  3. How to Create a Autonumber with dashes
    By sylviar in forum Access
    Replies: 5
    Last Post: 05-09-2013, 09:08 AM
  4. autonumber in table and forms
    By ismith in forum Forms
    Replies: 1
    Last Post: 01-04-2012, 10:50 AM
  5. CREATE TABLE and AutoNumber fields
    By JTeagle in forum Queries
    Replies: 1
    Last Post: 11-10-2011, 03:31 AM

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