Deleting

miss_sunshine

Registered User.
Local time
Today, 02:01
Joined
Dec 13, 2004
Messages
17
I have a client table, with a field called "status" which says whether they are "current" or "past".

I have a delete button on a form to delete clients, but would like to only permit past clients to be deleted. I would like incorporate a message box to say "you cannot delete a current client", and for no changes to be made when "ok" is clicked.

If a past client is to be deleted, I would like a message to say "Are you sure you want to delete all details of (client name)", and a yes/no option.

I know this can probably be done through coding but I am not too familiar with VBA. Does anyone have an example of some code I could use to make this work?
 
Actually I would check the value of your field on each record change (current to the form) and if it is "current" I would disable the delete button so it can not be used and if "past" enable it so it can be used.
On the ON Click event of the button then you have a msgbox that asks your question with YES/NO buttons, and if they click yes it does the delete.
 

Users who are viewing this thread

Back
Top Bottom