Solved Save record on form close

L1l_m5_P1gg13

New member
Local time
Today, 13:16
Joined
May 14, 2020
Messages
7
Without going into massive detail, what i need is to write code on form close, that would check to see if all the data has been input and remove the record if not?

Example Fields
Serial Number
Comment

If the user enters a serial number but does not enter a comment I want to remove that entry from my table.

Any help would be massively appreciated :)

Thank you
 
Without going into massive detail, what i need is to write code on form close, that would check to see if all the data has been input and remove the record if not?

Example Fields
Serial Number
Comment

If the user enters a serial number but does not enter a comment I want to remove that entry from my table.

Any help would be massively appreciated :)

Thank you
IMHO Validation code is best used in the forms Before Update event which can be cancelled, there by preventing the record being saved.
 
see post #2.
you can also remove incomplete records on the form's close/unload event:

private sub form_close()
currentdb.execute "delete * from ExampleTable where (([Serial Number]) Is Null) Or ((Comment) Is Null);"
end sub
 
see post #2.
you can also remove incomplete records on the form's close/unload event:

private sub form_close()
currentdb.execute "delete * from ExampleTable where (([Serial Number]) Is Null) Or ((Comment) Is Null);"
end sub

That worked perfectly! Thank you so much :)
 

Users who are viewing this thread

Back
Top Bottom