Results 1 to 7 of 7
  1. #1
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67

    Preventing Auto New Record

    Hi,

    How can I prevent the form (in this case a subform) from automatically creating a new record when I leave the final field.
    I want the user to have a specific button to allow them to specifically create a new record.

    I'm sure I did read about this, once, a long time ago, but age has taken its toll and my memory isn't whaty it was. So any help much appreciatede.

    Prof.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Change the Cycle property of the SubForm to Current Record.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Two things:

    Changing the Cycle Property to Current Record, as Allan suggested, will keep a user from automatically moving to a New Record, but if this is a Datasheet or Continuous View Subform (as they usually are) once they enter a single character in the Current Record, the Access Gnomes are going to make a blank, New Record appear below the Current Record, waiting for you to move there.

    If you want to make the entering a New Record totally dependent on the user clicking a Command Button, you'll have to set the AllowAdditions Property of the Subform to 'No,' by default. Best way to do this would be using the Form_Current event and something like this:
    Code:
    Private Sub Form_Current()
     If Me.NewRecord Then
      Me.AllowAdditions = True
     Else
      Me.AllowAdditions = False
    End If
    End Sub


    You'd then have to use a button to set it, temporarily to 'Yes,' to allow a New Record to be entered.

    Also note that you cannot have Command Buttons on Datasheet View Forms. The workaround is usually to use the DoubleClick event of a Textbox.

    Linq ;0)>

    Late note: I just discovered that in a Datasheet View Form, setting the Cycle Property to 'Current Record' does not prevent the Focus from going to a New Record! Don't know whether this was true in older (or newer) versions, or not! Maybe Allan can check it out in v2010.

  4. #4
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67
    Thank you both - just what I needed. I'll try the various points mentioned, and see how things go.

    Prof.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You can use the Thread Tools at the top of the thread to mark this thread Solved when you know your solution works.

  6. #6
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67
    Using the cycle property in form view, worked well - up to a point, but it didn't stop new records being created by using the Access' built in Record Navigation buttons in the Status Bar at the bottom of the form. So I decided to go with Linq's suggestion of coding manipulate the AllowAdditions property. Thanks for your help. Prof.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Excellent! Thanks for posting back.

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

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Auto status a record
    By yes sir in forum Database Design
    Replies: 6
    Last Post: 06-11-2012, 08:46 PM
  3. Auto Delete record after 3 years?
    By maxx102 in forum Access
    Replies: 3
    Last Post: 06-01-2012, 08:55 PM
  4. Auto Record create across tables
    By b123 in forum Database Design
    Replies: 15
    Last Post: 10-02-2010, 01:36 AM
  5. Auto Generate Record
    By mjhopler in forum Forms
    Replies: 2
    Last Post: 02-10-2010, 03:40 PM

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