Pop-Up/Modal mystery?!?

LEXCERM

Registered User.
Local time
Today, 15:04
Joined
Apr 12, 2004
Messages
169
Evening All,

I have a form with the following event codes:-

Private Sub Form_Current()
DoCmd.GoToRecord , , acFirst
End Sub

Private Sub close_Click()
DoCmd.SetWarnings False
MsgBox "Returning to Main Menu." & vbCrLf & vbCrLf & "Any details on this form will not be saved.", , " "
On Error Resume Next
DoCmd.RunCommand acCmdUndo
DoCmd.Close acForm, "FRM_create new", acSaveNo
DoCmd.OpenForm "FRM_MAIN MENU", acNormal, "", "", , acNormal
End Sub

If the form is set with the POP-UP and MODAL properties set to "no" and I have entered details on the form, scrolled the mouse wheel by mistake, then decide to use the "close_click" event, the record is not saved to the table...which is what I want it to do.

However, if the POP-UP and MODAL properties are set to "yes", then when I close the form the record saves to the table...which I DON'T want it to do!

What am I missing here???

Regards.
 
If you don't want to save any changes then why are you allowing them in the first place?
 
Okay.

User open forms, starts completing the necessary data, then decides he/she needs to abandon the entry for whatever reason. They have completed certain primary key fields and some other fields that require data are missing. I do not want this part record saved in the table.

They can go in later and start afresh.

Regards.
 
Then either use the BeforeUpdate event to trap the missing entries or Undo the changes, or set the other fields required to yes in the table
 

Users who are viewing this thread

Back
Top Bottom