burritonator
IS-IT--Management
I have a module that contains the following two lines of code:
-----------------------------------------------------------
DoCmd.GoToRecord , , acNewRec
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
-----------------------------------------------------------
The reason that these two lines of code appear together in the module with nothing between them is because the fields on the form already contain the data that I want to write to the table, so I am just trying to create a new record in the table and write the form's data to it.
The problem is that every time this code executes, it always overwrites the first record in the table instead of adding a new record to the table, so that there is never actually more than one record in the table at a given time. I can't figure why this is happening, as I thought the "DoCmd.GoToRecord , , acNewRec" line of code would ensure that the data gets written to a new record in the table. In addition, I've used the same code in other places in my project, and it works just fine. Granted, I usually have several other lines of code between the two shown above, but none of it is code that has any effect on record navigation or manipulation, so I don't understand why the two lines above do not work properly when they appear side by side in the code.
Thanks in advance for any help that anyone can provide.
Burrito
-----------------------------------------------------------
DoCmd.GoToRecord , , acNewRec
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
-----------------------------------------------------------
The reason that these two lines of code appear together in the module with nothing between them is because the fields on the form already contain the data that I want to write to the table, so I am just trying to create a new record in the table and write the form's data to it.
The problem is that every time this code executes, it always overwrites the first record in the table instead of adding a new record to the table, so that there is never actually more than one record in the table at a given time. I can't figure why this is happening, as I thought the "DoCmd.GoToRecord , , acNewRec" line of code would ensure that the data gets written to a new record in the table. In addition, I've used the same code in other places in my project, and it works just fine. Granted, I usually have several other lines of code between the two shown above, but none of it is code that has any effect on record navigation or manipulation, so I don't understand why the two lines above do not work properly when they appear side by side in the code.
Thanks in advance for any help that anyone can provide.
Burrito