-
I have an access97 db attached to my vb 5 program with DAO. When I type a record in it will save the record to the database no matter what. So if the user doesnt complete fields the record is still saved to the database. Does anyone know how to not save the record to the database say if a certain field wasnt filled out?
So it would abandon the record if certain fields were not completed??
Thanks
-
You can put this code inside the button on which you press to put the data in the Access Table.
private sub cmd????()
if ucase(trim(txt???)) = "" then
msgbox "This field needs to be filled out", , "Missing Data"
txt????.setfocus
exit sub
end if
This code will not allow the user to save until the field is filled out.
Hope this helps you out!
-
But if i enter information on the form and exit out even if I dont click on save then come back into the program the partial data is still listed in the database
-
Don't use the AddNew method until your user presses a "Submit" button. Then, validate the entries, add a new record and populate the database fields.