I have a form that I want to open on a new record (with an Autonumber-based ID string that is a calculated field) and this uses a hidden field in the form when it opens to spawn a new record, ready to be related to some additional items in a join table. The user selects those from a list box.
I want to add a "return to main menu without saving" button, but not matter what code I use, it obstinately continues to save the record.
For example, I used
on the command button - no effect.
I also tried this code on the form's BeforeUpdate method. No effect. The new record continues to exist.
How do I achieve this please? I suppose I can 'query out' incomplete records at other places in the database, but it's annoying to not be able to return to the same JobID again if you don't save it.
Thanks for any help.
I want to add a "return to main menu without saving" button, but not matter what code I use, it obstinately continues to save the record.
For example, I used
Code:
DoCmd.Close acForm, "JobPlanfromCAFs", acSaveNo
on the command button - no effect.
I also tried this code on the form's BeforeUpdate method. No effect. The new record continues to exist.
Code:
If Not (Me.NewRecord) Then
If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
Me.Undo
End If
Else
If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
Me.Undo
End If
End If
How do I achieve this please? I suppose I can 'query out' incomplete records at other places in the database, but it's annoying to not be able to return to the same JobID again if you don't save it.
Thanks for any help.