I have a query-based form that handles complaints. As the complaint climbs the ladder, most of the information should go from 1 record to another. Becuase a fair number of the fields could be left blank, trying to trap every possible error when Nulls or ""'s are abound seemed overwhelming so I had an on error resume next. When the users reported occasional looping issues, I knew I needed a different way. Within the trouble-shooting, I was putting msgboxs all over the place to see what was working and what wasnt. Right now, the code appears to be working, but most of the MsgBoxs aren't showing.
Thoughts??
Inconsistant
Private Sub Escalate_Click()
On Error GoTo ErrorHandler
MsgBox "got this far!!", vbOKOnly, "Bleh" ‘This shows
If AppealClosed = False Then
MsgBox "Appeal must be closed before it can be escalated to the next level"
Exit Sub
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'save record
SendKeys "{ESC} {ESC}"
MsgBox "here??" ‘ Sometimes shows
Dim tmpID As String
Dim tmpAppealedBy As Integer
Dim tmpHasGuardian As Boolean
Dim tmpGuardianTitle As String
Dim tmpGuardianFName As String
Dim tmpGuardianLName As String
Dim tmpAppellantTitle As String
Dim tmpAppellantFName As String
Dim tmpAppellantLName As String
Dim tmpAppellantAdd1 As String
Dim tmpAppellantAdd2 As String
Dim tmpAppellantCity As String
Dim tmpAppellantState As String
Dim tmpAppellantZip As String
Dim tmpAppellantPhone As String
Dim tmpAppellantPhone2 As String
Dim tmpAppellantFax As String
Dim tmpAppellantEMail As String
Dim tmpAfter5 As Boolean
Dim tmpFirstDenial As Date
Dim tmpLastAuthorizedDay As Date
Dim tmpDOSAge As Integer
Dim tmpAgeGrp As String
Dim tmpRequestedLOC As Integer
Dim tmpAdm_Con_Ret As Integer
Dim tmpOfferedLOC As Integer
Dim tmpFacility As String
Dim tmpProvider As String
Dim tmpAdmitDate As Date
Dim tmpDCDate As Date
Dim tmpDiagnosis As String
Dim tmpMNCTreatment As Integer
MsgBox "everything dimmed" ‘never shows
'capture data
tmpID = ID
tmpHasGuardian = HasGuardian
tmpGuardianTitle = GuardianTitle
tmpGuardianFName = GuardianFName
tmpGuardianLName = GuardianLName
tmpAppealedBy = AppealedBy
tmpAppellantTitle = AppellantTitle
tmpAppellantFName = AppellantFName
tmpAppellantLName = AppellantLName
tmpAppellantAdd1 = AppellantAdd1
tmpAppellantAdd2 = AppellantAdd2
tmpAppellantCity = AppellantCity
tmpAppellantState = AppellantState
tmpAppellantZip = AppellantZip
tmpAppellantPhone = AppellantPhone
tmpAppellantPhone2 = AppellantPhone2
tmpAfter5 = After5
tmpAppellantFax = AppellantFax
tmpAppellantEMail = AppellantEMail
tmpFirstDenial = FirstDenial
tmpLastAuthorizedDay = LastAuthorizedDay
tmpDOSAge = DOSAge
tmpAgeGrp = AgeGrp
tmpRequestedLOC = RequestedLOC
tmpFacility = Facility
tmpAdm_Con_Ret = Adm_Con_Ret
tmpAdmitDate = AdmitDate
tmpDCDate = DCDate
tmpOfferedLOC = OfferedLOC
tmpDiagnosis = Diagnosis
tmpMNCTreatment = MNCTreatment
MsgBox "data copied" ‘never shows
'New Record
DoCmd.GoToRecord , , acNewRec
'set new values
AppealInit = Now
AppealEnteredBy = CurrentNetID
'paste in the data on the new record
ID = tmpID
HasGuardian = tmpHasGuardian
GuardianTitle = tmpGuardianTitle
GuardianFName = tmpGuardianFName
GuardianLName = tmpGuardianLName
AppealedBy = tmpAppealedBy
AppellantTitle = tmpAppellantTitle
AppellantFName = tmpAppellantFName
AppellantLName = tmpAppellantLName
AppellantAdd1 = tmpAppellantAdd1
AppellantAdd2 = tmpAppellantAdd2
AppellantCity = tmpAppellantCity
AppellantState = tmpAppellantState
AppellantZip = tmpAppellantZip
AppellantPhone = tmpAppellantPhone
AppellantPhone2 = tmpAppellantPhone2
AdmitDate = tmpAdmitDate
After5 = tmpAfter5
AppellantFax = tmpAppellantFax
AppellantEMail = tmpAppellantEMail
FirstDenial = tmpFirstDenial
LastAuthorizedDay = tmpLastAuthorizedDay
DOSAge = tmpDOSAge
AgeGrp = tmpAgeGrp
Adm_Con_Ret = tmpAdm_Con_Ret
RequestedLOC = tmpRequestedLOC
OfferedLOC = tmpOfferedLOC
Facility = tmpFacility
Diagnosis = tmpDiagnosis
MNCTreatment = tmpMNCTreatment
If IsNull(AdmitDate) = False Then AdmitDate = tmpAdmitDate
If IsNull(DCDate) = False Then DCDate = tmpDCDate
'
' update everything
'
RefreshScreen
Forms![frm_appealentry]!sfrm_MNC.Requery
MsgBox "New record created. Please update the " & vbCrLf & "PA Level" & vbCrLf & "the Attending MD" & vbCrLf & _
"the MD Reviewer" & vbCrLf & "Dr's Rationale", vbInformation ‘ Sometimes shows
Exit Sub
ErrorHandler: ' Error-handling routine.
Select Case Err.number ' Evaluate error number.
Case 94, 3315 ' invalid use of null
Err.Clear
Resume Next
MsgBox "error handled"
Case Else
MsgBox Err.number & " " & Err.Description, , "Something else"
End Select
Resume Next
MsgBox "Shouldnt see this!"
End Sub
Thoughts??
Inconsistant
Private Sub Escalate_Click()
On Error GoTo ErrorHandler
MsgBox "got this far!!", vbOKOnly, "Bleh" ‘This shows
If AppealClosed = False Then
MsgBox "Appeal must be closed before it can be escalated to the next level"
Exit Sub
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'save record
SendKeys "{ESC} {ESC}"
MsgBox "here??" ‘ Sometimes shows
Dim tmpID As String
Dim tmpAppealedBy As Integer
Dim tmpHasGuardian As Boolean
Dim tmpGuardianTitle As String
Dim tmpGuardianFName As String
Dim tmpGuardianLName As String
Dim tmpAppellantTitle As String
Dim tmpAppellantFName As String
Dim tmpAppellantLName As String
Dim tmpAppellantAdd1 As String
Dim tmpAppellantAdd2 As String
Dim tmpAppellantCity As String
Dim tmpAppellantState As String
Dim tmpAppellantZip As String
Dim tmpAppellantPhone As String
Dim tmpAppellantPhone2 As String
Dim tmpAppellantFax As String
Dim tmpAppellantEMail As String
Dim tmpAfter5 As Boolean
Dim tmpFirstDenial As Date
Dim tmpLastAuthorizedDay As Date
Dim tmpDOSAge As Integer
Dim tmpAgeGrp As String
Dim tmpRequestedLOC As Integer
Dim tmpAdm_Con_Ret As Integer
Dim tmpOfferedLOC As Integer
Dim tmpFacility As String
Dim tmpProvider As String
Dim tmpAdmitDate As Date
Dim tmpDCDate As Date
Dim tmpDiagnosis As String
Dim tmpMNCTreatment As Integer
MsgBox "everything dimmed" ‘never shows
'capture data
tmpID = ID
tmpHasGuardian = HasGuardian
tmpGuardianTitle = GuardianTitle
tmpGuardianFName = GuardianFName
tmpGuardianLName = GuardianLName
tmpAppealedBy = AppealedBy
tmpAppellantTitle = AppellantTitle
tmpAppellantFName = AppellantFName
tmpAppellantLName = AppellantLName
tmpAppellantAdd1 = AppellantAdd1
tmpAppellantAdd2 = AppellantAdd2
tmpAppellantCity = AppellantCity
tmpAppellantState = AppellantState
tmpAppellantZip = AppellantZip
tmpAppellantPhone = AppellantPhone
tmpAppellantPhone2 = AppellantPhone2
tmpAfter5 = After5
tmpAppellantFax = AppellantFax
tmpAppellantEMail = AppellantEMail
tmpFirstDenial = FirstDenial
tmpLastAuthorizedDay = LastAuthorizedDay
tmpDOSAge = DOSAge
tmpAgeGrp = AgeGrp
tmpRequestedLOC = RequestedLOC
tmpFacility = Facility
tmpAdm_Con_Ret = Adm_Con_Ret
tmpAdmitDate = AdmitDate
tmpDCDate = DCDate
tmpOfferedLOC = OfferedLOC
tmpDiagnosis = Diagnosis
tmpMNCTreatment = MNCTreatment
MsgBox "data copied" ‘never shows
'New Record
DoCmd.GoToRecord , , acNewRec
'set new values
AppealInit = Now
AppealEnteredBy = CurrentNetID
'paste in the data on the new record
ID = tmpID
HasGuardian = tmpHasGuardian
GuardianTitle = tmpGuardianTitle
GuardianFName = tmpGuardianFName
GuardianLName = tmpGuardianLName
AppealedBy = tmpAppealedBy
AppellantTitle = tmpAppellantTitle
AppellantFName = tmpAppellantFName
AppellantLName = tmpAppellantLName
AppellantAdd1 = tmpAppellantAdd1
AppellantAdd2 = tmpAppellantAdd2
AppellantCity = tmpAppellantCity
AppellantState = tmpAppellantState
AppellantZip = tmpAppellantZip
AppellantPhone = tmpAppellantPhone
AppellantPhone2 = tmpAppellantPhone2
AdmitDate = tmpAdmitDate
After5 = tmpAfter5
AppellantFax = tmpAppellantFax
AppellantEMail = tmpAppellantEMail
FirstDenial = tmpFirstDenial
LastAuthorizedDay = tmpLastAuthorizedDay
DOSAge = tmpDOSAge
AgeGrp = tmpAgeGrp
Adm_Con_Ret = tmpAdm_Con_Ret
RequestedLOC = tmpRequestedLOC
OfferedLOC = tmpOfferedLOC
Facility = tmpFacility
Diagnosis = tmpDiagnosis
MNCTreatment = tmpMNCTreatment
If IsNull(AdmitDate) = False Then AdmitDate = tmpAdmitDate
If IsNull(DCDate) = False Then DCDate = tmpDCDate
'
' update everything
'
RefreshScreen
Forms![frm_appealentry]!sfrm_MNC.Requery
MsgBox "New record created. Please update the " & vbCrLf & "PA Level" & vbCrLf & "the Attending MD" & vbCrLf & _
"the MD Reviewer" & vbCrLf & "Dr's Rationale", vbInformation ‘ Sometimes shows
Exit Sub
ErrorHandler: ' Error-handling routine.
Select Case Err.number ' Evaluate error number.
Case 94, 3315 ' invalid use of null
Err.Clear
Resume Next
MsgBox "error handled"
Case Else
MsgBox Err.number & " " & Err.Description, , "Something else"
End Select
Resume Next
MsgBox "Shouldnt see this!"
End Sub