Results 1 to 2 of 2
  1. #1
    avdh0503 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2016
    Posts
    1

    problems adding records to tables

    Hi guys,
    In an application a number of forms calculate values that must be stored in new records in a number of different tables.
    In these forms I always use: me.recordsource="table1"


    docmd.gotorecord,,acnewrec.

    Most of the times this works perfectly. However, in a specific form Access is not adding a new record, but skips to the first record in the table and overwrites the values of the fields.
    It took me hours searching for an error in this form, but could not find one.
    Having no idea what was wrong I decided to open a new empty form and copy all object of the other form to it as well as the coding, delete the other form and gave the new form the name and properties of the other form. To my surprise the new form worked well.
    This occurred two more times with other forms, and the here mentioned solution worked there as well.
    I hope there is someone who can tell me what was wrong here.

    This application will be implemented on a customers pc and of course I'm wondering if the same can happen in his environment.
    If that is the case it might result in loss of valuable data.

    Thanks for your time,
    Ad

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Could you explain more about your process?


    In these forms I always use: me.recordsource="table1"
    docmd.gotorecord,,acnewrec.
    This really doesn't make any sense. If you are doing calculations in VBA, why aren't you using a SQL append statement to add the record?

    However, in a specific form Access is not adding a new record, but skips to the first record in the table and overwrites the values of the fields.
    Re-querying a form can/will cause the current record to move to the first record. Then it would overwrite the first record.

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

Similar Threads

  1. Problems adding a new entry
    By octsim in forum Programming
    Replies: 1
    Last Post: 10-24-2013, 07:35 AM
  2. Problems With Adding Data Back To Table
    By jimbob90 in forum Access
    Replies: 10
    Last Post: 09-30-2012, 05:28 PM
  3. Replies: 5
    Last Post: 12-04-2011, 10:52 PM
  4. Replies: 2
    Last Post: 04-04-2010, 06:14 PM
  5. Problems adding a drop down box to report/query
    By rachelm920 in forum Access
    Replies: 1
    Last Post: 05-14-2009, 09:19 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