Attached is a project I am working on. It's a personal reminder program. The problem I am having is that when I enter the actual completion date at the bottom and click on the "Complete Task" button, I want the record to be copied to the History table, then the Start Date and Due Dates reset based on the Frequency. If someone could look at the On Click event procedure for this button and help me get this fixed, I would appreciate it very much. I don't know much about VB or SQL coding.
Okay, I've been looking through here and I do have some suggestions to make your db better.
1. Do not use the # sign in your field name. Change it to IDNum instead (or something else of your choosing). The # is a reserved character and using it where Access doesn't normally see it (as an identifier for dates) will just cause you pain and grief, if not now, in the future.
2. Name your buttons (as well as other controls). With names like Button96, it makes it very difficult for someone else to maintain your database when you are no longer there. It is obvious that you used the Microsoft wizard to create the buttons, and while it gets the job done, they aren't the most elegant and useful. It also places excessive error handling code in place as well. It isn't necessary to have an error handler move back to an error_exit and just complicates things. I would suggest using MZ-Tools (do a web search) if you want to have more control over everything (plus they have a LOT of cool time-saving tools all in one download (and they're free).
3. You refer, in the button96 click event, a control of [completion date], but it appears to really be COMPLETE_DATE that should be referenced instead.
3. I noticed the SQL for insertion into the History table and the one for deletion from the Tasks table was incorrect. I corrected that.
4. Also, there is no reason to move forward and then back to save the record. Just use:
Code:
Docmd.RunCommand acCmdSaveRecord
I am uploading it here so you can see what I did. As for the dates, you can set yourself variables to take the existing dates and use DateAdd to set it to the next date that fits the frequency. If you do that and then delete and then set the fields to the values of the variables, that should work for you.