Results 1 to 3 of 3
  1. #1
    freebird_wr is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2020
    Posts
    1

    Undo record when switching to design view


    In designing a new form in my test database, I have to move from form to design view constantly. When I click "Design View" I get the error that I must enter a value in the primary key field. In production when a user clicks "Close" I just Undo the form. How can I avoid that error when going to design view or clicking the "X" to exit?

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Add your undo to the unload event (don't forget to take it out when deploying into production).

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You shouldn't have to do that. Is your PK field an Autonumber? It should be.

    Microsoft Access Tables: Primary Key Tips and Techniques


    AutoNumber
    ----------------
    Purpose: Use an AutoNumber field to provide a unique value that serves no other purpose than to make each record unique. The most common use for an AutoNumber field is as a primary key.



    And Welcome to the forum....

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

Similar Threads

  1. Replies: 10
    Last Post: 02-06-2018, 02:37 PM
  2. Undo New Record IF
    By data808 in forum Programming
    Replies: 3
    Last Post: 02-22-2014, 07:59 AM
  3. Replies: 9
    Last Post: 10-09-2013, 08:45 AM
  4. Replies: 3
    Last Post: 12-19-2011, 11:39 AM
  5. Undo Table Design Changes
    By MelindaP in forum Database Design
    Replies: 6
    Last Post: 07-27-2010, 09:07 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