Results 1 to 2 of 2
  1. #1
    Pragmatic is offline Novice
    Windows XP Access 2000
    Join Date
    Sep 2011
    Posts
    9

    Creation of autonumber on open form

    Hi all

    I have two forms Customer and orders. There is a button on customer form which on a click opens up a orders form with corresponding customer id and orderID for which I have used the following code.

    Private Sub Form_Open(Cancel As Integer)
    If Not IsNull(Me.OpenArgs) Then
    DoCmd.GoToRecord , , acNewRec
    Me.CustomerID = Me.OpenArgs
    End If
    End Sub




    Now what I want to achieve is that when I click on "Add order" button it should open up the order form with customerid and do create the order id until I either exit/close the order form. Can someone advise/ recommend the chages in the above code to get the required result.

    Thank in advance for your reply.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Is OrderID an Autonumber datatype field? If so, you cannot delay generating that number. It will be created as soon as any field of the new record is populated.
    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. Replies: 9
    Last Post: 06-20-2011, 03:42 PM
  2. sql temp table creation for form
    By Ian_ in forum Forms
    Replies: 2
    Last Post: 06-17-2011, 03:27 AM
  3. Form Design/Timesheet Creation
    By DKF in forum Forms
    Replies: 1
    Last Post: 05-28-2010, 07:09 PM
  4. Access 2007 - Form Creation
    By p4ck3tl055 in forum Forms
    Replies: 5
    Last Post: 03-18-2010, 12:43 PM
  5. Problems with autonumber field in a form
    By admaldo in forum Forms
    Replies: 0
    Last Post: 02-25-2008, 11:09 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