I'm in Access 2007. I built a feature that to saves the current list in a sub form to a separate table. It works like this: After entering a list of words in the subform, the user can choose to push a button, and a dialog box appears. The user enters a name into the dialog box to identify the list for later use, presses OK and the list is saved.
In the code, I'm using DoCmd.RunSql on the data in the table, so all the data in the sub form needs to be saved to the underlying table in order for the feature to work properly.
The problem occurs on the last item of data in the sub form. If I enter data into the last field, and I do not hit enter/return, and I go right to pressing the button to save the list, the data in the last field will not get saved because it was not saved to the table.
If I attempt to force a save with something like Docmd.RunCommand acSave, I cause 2 problems: 1) If the user did hit return and the data is saved, calling acSave can produce and error. 2) I only want to save the data in the subform. I do not want to apply acSave to the main form.
I assume I need some code in the feature-button to save the last item in the sub form, but I don't know what it should be. Can anyone tell me how I can correct this feature so the last piece of data in the subform is stored in the underlying table, regardless of if the user pressed enter/return?
Thanks,
Adam