VBA Code in an After Update Event Exiting Access - BCP

G

Guest

I have an After Update event that dumps the user completely out of Access.
The best part is it only happenes intermittently and for some users more than
others. Also if I break the code and step through it it works fine.
 
N

Nick Coe \(UK\)

In BCP typed:
I have an After Update event that dumps the user
completely out of
Access. The best part is it only happenes intermittently
and for some
users more than others. Also if I break the code and step
through it
it works fine.

Need a bit more context info than that.

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/
Download Free Copy
----
 
G

Guest

When the On Click event is executed from the form MS Access shuts down. If a
break point is put into the code and the code is steped through it executes
fine.

OS: Win2K for NT
Access Version: Access 97
Ram: 128 Mb
The following code is executed on the On Click event ona form.
Private Sub SignSel1_Click()
If Me![SignSel1] = "Cancel" Then
Me![Action] = Null
Me![SignSrc1] = ""
Me![SignDt1] = Null
Me![ActCompDt1] = Null
MsgBox "Cancelling does not reset the Project Status - please ensure
status is reset in Project Master to original value."
If (Forms![Active Release Log Update]![StatCd1] = "Prod") And
(Forms![Active Release Log Update]![Status] = "Prod") Then
Forms![Active Release Log Update]![Status Date] = Date
Forms![Active Release Log Update]![Status] = "QA"
DoCmd.OpenForm ("Audit Table"), acNormal, , , acFormAdd, acHidden
Forms![Audit Table]![Audit Source] = [CurrentUser]
Forms![Audit Table]![Audit Field] = "Status Reset"
Forms![Audit Table]![Audit New Value] = Forms![Active Release
Log Update]![Status]
Forms![Audit Table]![Audit Project Number] = Me![Project Number]
DoCmd.Close acForm, "Audit Table", acSaveNo
GoTo BypassSO:
Else
GoTo BypassSO:
End If
End If

If (Forms![Active Release Log Update]![Status] = "QDen") Or
(Forms![Active Release Log Update]![Status] = "TDen") Then
MsgBox "You may not approve a project in denied status, please reset
the Denial button and then retry"
GoTo BypassSO:
End If
If (Forms![Active Release Log]![DepNotOK] = "NO") And (Forms![Active
Release Log Update]![Status] = "TOG") Then
MsgBox "You may not approve a project when it contains subordinate
projects that have not been approved"
GoTo BypassSO:
End If

If (Forms![Active Release Log]![OpenTkt] > "") Then
DoCmd.OpenForm "Active Release Log OpenTkt Popup", acNormal
GoTo BypassSO:
End If

If Me![SignSrc1] > "" Then
Me![SignSrc1] = Me![SignSrc1] & ", " & Me![Resource1] & "(" & Date &
"/" & [CurrentUser] & ")"
Else
Me![SignSrc1] = Me![Resource1] & "(" & Date & "/" & [CurrentUser] &
")"
End If
Me![SignDt1] = Date
DoCmd.OpenForm ("Audit Table"), acNormal, , , acFormAdd, acHidden
Forms![Audit Table]![Audit Source] = [CurrentUser]
Forms![Audit Table]![Audit Field] = "SignoffSel"
Forms![Audit Table]![Audit New Value] = Me![SignSrc1] & " for " &
Me![StatCd1]
Forms![Audit Table]![Audit Project Number] = Me![Project Number]
DoCmd.Close acForm, "Audit Table", acSaveNo

If Me![ActCompDt1] > "" Then
GoTo BypassSO:
End If
If (Forms![Active Release Log Update]![StatCd1] = "Prod") And
(Forms![Active Release Log Update]![OKtoProd] <> "Yes") Then
If Me![Release Key] Like "*-n*" Then
GoTo BypassSO:
Else
Me![Action] = "SATApp"
GoTo BypassSO:
End If
Else
Me![ActCompDt1] = Me![SignDt1]
End If
DoCmd.OpenForm ("Audit Table"), acNormal, , , acFormAdd, acHidden
Forms![Audit Table]![Audit Source] = [CurrentUser]
Forms![Audit Table]![Audit Field] = "Act Comp Dt"
Forms![Audit Table]![Audit New Value] = Me![ActCompDt1] & " for " &
Me![StatCd1]
Forms![Audit Table]![Audit Project Number] = Me![Project Number]
DoCmd.Close acForm, "Audit Table", acSaveYes
If (Forms![Active Release Log Update]![Status] = "TOG") And
(Forms![Active Release Log Update]![StatCd1] = "TOG") Then
Forms![Active Release Log Update]![Status Date] = Me![ActCompDt1]
Forms![Active Release Log Update]![Status] = "QA"
DoCmd.Save
If (Me![Release Key] Like "*-Q*") Then
Me![Action] = "ToQA"
End If
ElseIf (Forms![Active Release Log Update]![Status] = "QA") And
(Forms![Active Release Log Update]![StatCd1] = "Prod") Then
Forms![Active Release Log Update]![Status Date] = Me![ActCompDt1]
Forms![Active Release Log Update]![Status] = "Prod"
DoCmd.Save
If (Me![Release Key] Like "#.#*") Then
Else
Me![Action] = "ToProd"
End If
End If
BypassSO:
End Sub
 
N

Nick Coe \(UK\)

In BCP typed:
When the On Click event is executed from the form MS
Access shuts
down. If a break point is put into the code and the code
is steped
through it executes fine.

OS: Win2K for NT
Access Version: Access 97
Ram: 128 Mb
The following code is executed on the On Click event ona
form.
Private Sub SignSel1_Click()

SNIPPED

Do you get anything if you put error trapping in?
Private Sub SignSel1_Click()
'Add second line;
On Error GoTo HandleErr

then in the penultimate line of your code;

ExitHere:
Exit Sub

HandleErr:
MsgBox "Error " & Err.Number & ": " & Err.Description,
vbCritical
Resume ExitHere

End Sub

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/
Download Free Copy
----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top