Results 1 to 9 of 9
  1. #1
    DataUser is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5

    Overwriting Records?


    I created a database to track my time. (Screen-shot is attached). Sometimes when I submit my time Access seems to put the record over a previous record, and thus replacing. I'm wanting it to just keep going to the next record. You'll notice in the screen-shot that it would update the first record of the datasheet if I hit submit. Any help anyone can give is appreciated. If needed, I can take a Camtasia shot, which might help show things a little better. Thanks!!

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by DataUser View Post
    I created a database to track my time. (Screen-shot is attached). Sometimes when I submit my time Access seems to put the record over a previous record, and thus replacing. I'm wanting it to just keep going to the next record. You'll notice in the screen-shot that it would update the first record of the datasheet if I hit submit. Any help anyone can give is appreciated. If needed, I can take a Camtasia shot, which might help show things a little better. Thanks!!
    Are you saying that you want the record to appear in the botton of the list?

  3. #3
    DataUser is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5
    Quote Originally Posted by Toyman View Post
    Are you saying that you want the record to appear in the botton of the list?
    Yes. Because that seems to be why it keeps overwriting the records. Sometimes it works fine and adds the records to the bottom of the datasheet. But then it adds them in other spots, which overwrites the record that was previously there. (If this doesn't make sense, I understand!)

  4. #4
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by DataUser View Post
    Yes. Because that seems to be why it keeps overwriting the records. Sometimes it works fine and adds the records to the bottom of the datasheet. But then it adds them in other spots, which overwrites the record that was previously there. (If this doesn't make sense, I understand!)
    Ok, the problem is in the sort order of query for the list form. You need to put a sort in the time (ascending). However, since the time period you entered is not actually a time field, you will have to create a time field in you query for the sort. In the underlaying query, create a new field and put the follow:

    StartTime: CDate(Left([YourTimePeriodFieldName],instr([YourTimePeriodFieldName]," ")-1))

    Replace "YourTimePeriodFieldName" with the field name for the Time Period field. If there is a space between the end of the first time and the hyphen leave the " " at the end of the "instr" function. If it does not have a space replace " " with "-"
    Sort this new field ascending

  5. #5
    DataUser is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5
    Quote Originally Posted by Toyman View Post
    Ok, the problem is in the sort order of query for the list form. You need to put a sort in the time (ascending). However, since the time period you entered is not actually a time field, you will have to create a time field in you query for the sort. In the underlaying query, create a new field and put the follow:

    StartTime: CDate(Left([YourTimePeriodFieldName],instr([YourTimePeriodFieldName]," ")-1))

    Replace "YourTimePeriodFieldName" with the field name for the Time Period field. If there is a space between the end of the first time and the hyphen leave the " " at the end of the "instr" function. If it does not have a space replace " " with "-"
    Sort this new field ascending
    Excellent! Thank you so much for the help!

  6. #6
    DataUser is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5
    Actually, something seems to be wrong with the datasheet itself. (My form main form - not the sub - is displaying the first row). I went ahead and zipped the database and attached it. If anyone could take a second to look at it, I would be grateful. I'm just getting started, and I think I jumped in over my head

  7. #7
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by DataUser View Post
    Actually, something seems to be wrong with the datasheet itself. (My form main form - not the sub - is displaying the first row). I went ahead and zipped the database and attached it. If anyone could take a second to look at it, I would be grateful. I'm just getting started, and I think I jumped in over my head
    Ok, I made some changes in the db. See is this works

  8. #8
    DataUser is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    5
    Quote Originally Posted by Toyman View Post
    Ok, I made some changes in the db. See is this works
    Now it's working perfectly! Thank you very much. Would you mind explaining what was wrong? I would love to get better at this. Thanks again.

  9. #9
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by DataUser View Post
    Now it's working perfectly! Thank you very much. Would you mind explaining what was wrong? I would love to get better at this. Thanks again.
    What you were trying to achieve was a way to enter the your data and display the data in a form of a running log. What I did was unbound your main form to the table. The combo boxes were also unbounded because you wanted to use a update button to save the data. After the fields were unbound, it now acts only as a entry field. Once the data is entered into the fields, I use an append sql statement tied to the update botton to append the new data to the table. After the data is updated, the last part of the code refreshes the subform displaying the newly entered record. Also, you have set the "time period" field as a number field. However, the number format you enter is this: 18:00-18:30. This is actually a text format. Because of that, I changed the format for the field to a text field. You also have a TimePeriodID in the order of the time period. I used this id to sort the time ascending. Therefore, when the subform is updated, the new record falls into place according to the sort order of the record.

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

Similar Threads

  1. Linking Workbook and Overwriting Excel File
    By Atheron in forum Import/Export Data
    Replies: 2
    Last Post: 10-08-2011, 03:44 PM
  2. Access 2007 - Creating New Records Based on Existing Records
    By GeorgeAugustinePhillips in forum Forms
    Replies: 9
    Last Post: 10-05-2011, 05:58 PM
  3. Replies: 12
    Last Post: 08-30-2011, 03:36 PM
  4. Overwriting Calculated Field
    By sidewayzalex in forum Forms
    Replies: 2
    Last Post: 08-24-2011, 05:52 AM
  5. overwriting table rows
    By VickyC in forum Forms
    Replies: 2
    Last Post: 09-23-2010, 07:58 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