MS Access - Data Entered in a Form Automatically saves when i close the form -


i've been tasked making updates ms access database , forms. each form seems linked query. if enter data text box on form , close form without pressing save record button new record still added database makes no sense to.

any insight great, i'm programmer have little experience working access forms , databases.

thanks.

microsoft access binds forms data default, , automatically save data either move between records or close form you're working on. average user, thing because makes difficult lose data, if accidentally close form after making edit.

if functionality isn't you're looking for, i'd suggest removing binding form, is, set record source property blank, manipulate data in code using unbound controls. it's lot more fiddly, gives lot more control.

the other option use form's beforeupdate event ask user if want save changes before allowing them go through.

if main concern accidentally adding new records, set allow additions property false, , create new records programmatically.

a sample of beforeupdate event procedure (the same code work beforeinsert event):

private sub form_beforeupdate(cancel integer)    dim intans integer    intans = msgbox("are sure want save record?", vbquestion + vbyesno, "save record")   if intans = vbno cancel = 1  end sub 

if use above method, , user clicked "no", have click esc key undo changes had entered. otherwise keep showing dialogue when moved off record.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo