Writing to DB before the form is done!!??

otis1969

Registered User.
Local time
Today, 07:30
Joined
Mar 13, 2003
Messages
42
I currently have a form that is supposed to write new records into a single table. I have some validation set up so that if you click the 'ADD' button, you get a msgbox that notifies you if any information is missing. but if the user enters a few pieces of information into the form and then either exits using the 'EXIT' button or the 'X' at the top of the screen, the partial information is written into the table. Again I am using my Access book to find this information, but it lacks this type of information.
 
If your form is bound to the table or a query based on the table then closing the form will save to the table, and your error checking is simply ignored.

To carry out your error checking, you could create an unbound form that uses text boxes to hold the data. This way, if the form is closed, there is no connection to the table. Your button will need to include code to write this info to the table.

Alternatively, you could disable the x and use code in your exit button to delete the record.

My more learned colleagues may have better ways of doing this.
 
Thanks, I guess the biggest obstacle for me is that I don't really feel that comfortable with VBA, even though I feel very comfortable with VB and VBScript. It just seems the wizards like to create code that I get, but wouldnt write that way..I guess!! Any way, if anyone knows a good place or book about VBA it would be appreciated. Lord knows I'll screw up this DB if I have to code an 'ADD' button!!
 
Otis, if the user tries to close the form when the record is partially complete, do you want the record to be deleted or the user forced to enter in the missing information?
 
Idjit said:
Otis, if the user tries to close the form when the record is partially complete, do you want the record to be deleted or the user forced to enter in the missing information?

i would like the record to be deleted. i have integrated the UNDO code with the exit button code (it works!), but now i get an error if i go into the form and then exit without any entries being made.

another thing...i guess i would like to know how to do the code by using unbound textboxes and then writing the recordset to the table.
 

Users who are viewing this thread

Back
Top Bottom