Great! Sounds like you are getting the hang of this stuff.
I'll outline my thinking on how to handle the remaining piece, although I'm sure that there are other approaches (and no doubt better).
1. When I say that the data from the calendar is "stored" temporarily, that could be as simple as the status of each textbox. So you can "store" the user clicks on the date by just toggling the background color. However, I would probably want to store the initial status and current status of the text boxes to minimize the amount of writing to the database see below. I would probably use an array of integers to do this. (An array declaration looks like "Dim MyArray(10) as Integer" )
2. You certainly could write each record into the database as the date is clicked. However, in general, it is good to try to reduce the amount of traffic into/out of the db. I'm also thinking that some users might click on one date, realize that it is an error then "unclick" it and click the correct one.
3. I'm certainly no expert here, but my feeling is that you would have better performance doing a small batch of records at the end of the interaction, than saving each change. However, unless you are designing this for a large multi-user environment, either method would probably be adequate. Someone else might be able to give you better advice, but I'd try whichever you are comfortable with and see how it performs.
4. I would try to avoid duplicates in the DateCompleted table, it just seems cleaner to me. Although with a little thought, you might be able to permit them and not run into major problems. Remember, you have to save the information each time you load the calendar - or switch between months - or move to a different task - or move to a different Program record - or close the form.
So here is the basic approach that I would use -
a) When you perform the query to determine which dates are grayed out, store the status of each day in the month in an integer array, called OriginalStatus().
b) Let the user muck about and click dates on/off to their content.
c) Before you leave the calendar (for a different month, different task or different program), trigger an event to save the status of the dates.
d) Loop through each day of the month and compare the status of the text box (gray or white) with the OrginalStatus array. If the status is the same, no change. If the status is different, then either add a new record (Text box clicked, but OriginalStatus is zero) or delete an existing one (Text box unclicked, and OriginalStatus is one).
There may be a little work in trapping out all the ways that a user can leave the calendar. Switching months or tasks use controls on the form which already have VBA code associated with them. There is supposedly an OnRecordExit event, but I'm not clear how to set it. Check the documentation. One work around would be to eliminate the record selectors on the bottom of the Program form and implement your own record navigation buttons, but then you start having to duplicate some of the built in functions.
One more thing, rather than have 42 OnClick events for the day boxes, I would probably overlay a transparent button and convert the x and y of the mouse click into a number that represents the correct box. You can then use the same approach that we used for setting the day numbers to address the appropriate text box and set the background color.
Good luck with things and post back if you have questions!
- g
=======================
Note regarding OnRecordExit !!
I did some additional looking and found out that OnRecordExit appears in the help system, it is not actually available! So, you would need to find some other means. There is supposedly a discussion of how to do this at the following site:
http://support.microsoft.com/default.aspx?scid=kb;en-us;304139
However, I haven't looked at it or tried it to see whether it works.
On