Deleting records

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a form based on a table with two subforms based on other tables. The
three tables involved are linked. I realise that when I move the focus from
the main form to the sub form the record is automatically saved. I already
have a message box that pops up on the BeforeUpdate of the main form that
asks if the user wants to save the record as I understand the BeforeUpdate
kicks in as the focus moves from the main form to the subform. I have a
command button on the form that is a Close button. I want to give the user
the option to delete the record at this point. I can't use Me.Undo because
by this time the record has already been saved. So basically I want a
message box to popup that says "Are you sure you want to save this record"
if they click Yes the form is closed if they click No the record is deleted
and the form is blank ready for a new input.

I think the code should go something like
If vbYes = MsgBox("Are you sure you want to create this record?", 36, "New
Record") Then
Docmd.Close
Else
(record deleted and form blank for new input)

What I need is the code that does the last bit in brackets for me
Hope I've explained my problem
TIA
Tony Williams
 
When the user decides they don't wnat to save the record,
use the command "cancel = -1" (or true)

Regards
 
Answered elsewhere.

PLEASE DON'T MULTI-POST! Multi-posting is where you post the same message
seperately, to several newsgroups. Multi-posting is >bad<, & wastes people's
time. Instead, CROSS-post. Cross-posting is where you send the message once,
to several newsgroups simultaneously, by putting all the relevant newsgroup
names in the Newsgroups: line of just one post.

Please search the web for the terms multiposting, crossposting and
netiquette for more information about this issue.

HTH,
TC
 
Back
Top