Results 1 to 2 of 2
  1. #1
    105ben is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    1

    How to stop a form adding a new record when changes are made on the form....

    Hello,



    I have a form and when I open it I add a value automatically (via code on form load) to one of the text boxes. This then creates a new record in the database, which I dont want.

    The user will sometimes go onto this form to simply see if a record exists. Currently, if it doesnt a blank one it created. This messes up all sorts of other things I do in the database, like compile stats.

    Any ideas how to prevent this? I know it can be done, as Ive done it before! I have another form which doesnt add a new record, but i cant remember how I did it.... and cant work it out on the form. Both forms are bound to tables too.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    instead of populating the value automatically why don't you wait until they start typing in the main record.

    You're using a bound form and if you do something like

    [dateAdded] = date()

    you are forcing a new record to be created.

    Instead do something in the ON EXIT property of one of your required fields (let's call it TESTFIELD) like

    Code:
    If Not Isnull(TESTFIELD) Then
        [DateAdded] = date()
    endif

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

Similar Threads

  1. How to stop form automatically adding records
    By linuxson in forum Access
    Replies: 33
    Last Post: 07-01-2014, 06:33 AM
  2. Replies: 9
    Last Post: 06-16-2014, 09:44 AM
  3. Replies: 7
    Last Post: 02-26-2013, 10:37 AM
  4. Stop Macro on Last Record in Form
    By wdkoseck in forum Access
    Replies: 1
    Last Post: 12-04-2012, 02:25 PM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 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