:banghead:On my form, I have a SSN and name field. If the SSN is blank, in the On Got Focus on the name field, it looks to see if SSN exists. If it's NULL, it tells the user they must enter, and asks do you want to enter now? Yes - goes back to SSN field (works fine). For No, I want it to close the form. Problem, I am getting a run-time error 2585. I've been searching for days on how to fix this error. From what I understand, a process on the form is still running. I can't figure out how to stop it. Here is my code (Yes - I have tried many variations without luck, but this is the last one). The code that's getting the 2585 error is DoCmd.Close acForm, "frmVetNewMainForm", acSaveNo.
If IsNull(Me.txtSSN) Then
strMsg = "Social Security Number Must Not Be Left Blank!" & vbCrLf
strMsg = strMsg & "Do you want to add new veteran's record?" & vbCrLf
If MsgBox(strMsg, vbQuestion + vbYesNo, "Go to Record?") = vbYes Then
Me.Undo
Me.Refresh
Me.txtSSN.SetFocus
Me.txtSSN.Value = Null
Exit Sub
Else
Me.Undo
Me.Refresh
Me.txtSSN.SetFocus
'Me.txtSSN.Value = Null
DoCmd.OpenForm "fmuMainMenu"
DoCmd.Close acForm, "frmVetNewMainForm", acSaveNo
End If
Else
... The rest works.
strMsg = "Social Security Number Must Not Be Left Blank!" & vbCrLf
strMsg = strMsg & "Do you want to add new veteran's record?" & vbCrLf
If MsgBox(strMsg, vbQuestion + vbYesNo, "Go to Record?") = vbYes Then
Me.Undo
Me.Refresh
Me.txtSSN.SetFocus
Me.txtSSN.Value = Null
Exit Sub
Else
Me.Undo
Me.Refresh
Me.txtSSN.SetFocus
'Me.txtSSN.Value = Null
DoCmd.OpenForm "fmuMainMenu"
DoCmd.Close acForm, "frmVetNewMainForm", acSaveNo
End If
Else
... The rest works.