Sabtu, 13 Desember 2014

Re: [MS_AccessPros] User clicks the X (close) button on a form in the upper-right hand corner and it closes.

 

Norbert-


The strange characters are the character representation of a bitmap.  It's similar to the encoding you will see if you see the raw text for an email that has images embedded.

I see lots of code that's commented out so that it does nothing.  For example:

Private Sub AgentFirstName_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
    
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

You should go through the code module and delete snippets like this so that Access doesn't waste time calling junk code.

What is the purpose of all the Mouse Up, Mouse Down, Key Up, and Key Down procedures?  Looks like a lot of old code commented out and replaced with a SetFocus.

And then this one caught my eye:

Private Sub ClientName_NotInList(NewData As String, Response As Integer)
 On Error GoTo PROC_ERR
    Dim strName As String
    Dim intReturn As Integer
    
    strName = StrConv(NewData, vbProperCase)
    intReturn = MsgBox("Client " & strName & _
        " is not in the system.  Do you want to add this Client?", _
        vbQuestion + vbYesNo, "ISM")
    If intReturn = vbYes Then
        DoCmd.OpenForm "frmClient", , , , acFormAdd, , Me.Name
        'FormName:="frmInterpreterAdd", _
            'DataMode:=acAdd, WindowMode:=acDialog, OpenArgs:=strInterpreterID
        If IsNothing(DLookup("ClientName", "qryClientNotInList", "ClientName = """ & strName & """")) Then
           Response = acDataErrContinue
        Else
            Response = acDataErrAdded
        End If
        Exit Sub
    End If
    Response = acDataErrDisplay
    Exit Sub
    
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

This code will NEVER work because the form isn't opened WindowMode:=acDialog.  That is commented out.  Why?

I could spend a lot more time wading through this code to try to spot something, but you need to clean it up first!

Also, you mentioned subforms - it might be code in one of those that is causing the loop.


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Dec 13, 2014, at 5:09 PM, drnorbert@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Bill,

As per your suggestion here is the text file of the frmMaster:

This is something new for me, I am interesting in what is what you are looking.

What is the purpose of all this strange characters: 0x00e0fe3f00000000000000003b00000023000000230000000200000000fc5615 ,

Is the form corrupted?

Let me know your comments.

Thanks a lot

Norbert

CodeBehindForm
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit
Dim intMasterComments As Integer
Public intPopulate As Integer
Public lgPriorMasterFileNo As Long
Private Sub AgentFirstName_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub AgentLastName_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub BusStreet_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub BusStreet2_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

'---------------------------------------------------------------------------------------
' Procedure : AccountNo_AfterUpdate
' Author    : Norbert
' Date      : 11/17/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub AccountNo_AfterUpdate()
On Error GoTo AccountNo_AfterUpdate_Error
If IsNothing(Me.AccountNo) Then
    MsgBox "Missing AccountNo", vbCritical, "ISM"
    Me.AccountNo.SetFocus
    Exit Sub
End If
If IsNothing(Me.TRNo) Then
    MsgBox "Missing TRNo", vbCritical, "ISM"
    Me.TRNo.SetFocus
    Exit Sub
End If


If Nz(DCount("*", "QS_TransRouteTRAcct")) > 0 Then
    DoCmd.OpenForm "frmTransRouteTRAcct", acNormal, , , , acDialog, Me.Name
   
End If

   On Error GoTo 0
   Exit Sub

AccountNo_AfterUpdate_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure AccountNo_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Agentid_AfterUpdate
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Agentid_AfterUpdate()
On Error GoTo Agentid_AfterUpdate_Error
If Me.lblWarningMaster.Caption = "NEW" Then
    If Me.AgentID.Column(2) = "T" Then
        MsgBox "AGENT " & Me.AgentID & " - " & UCase(Me.AgentID.Column(1)) & vbCrLf & vbCrLf & "IS TERMINATED!", vbCritical, "ISM WARNING"
        Me.AgentID = ""
        Me.AgentID.SetFocus
    End If
End If
On Error GoTo 0
Exit Sub
Agentid_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Agentid_AfterUpdate of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Agentid_MouseUp
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Agentid_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo Agentid_MouseUp_Error
If X >= 1095 And X <= 1290 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.AgentName.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If
'MsgBox X
On Error GoTo 0
Exit Sub
Agentid_MouseUp_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Agentid_MouseUp of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : AgentID2_AfterUpdate
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub AgentID2_AfterUpdate()
On Error GoTo AgentID2_AfterUpdate_Error
If Me.lblWarningMaster.Caption = "NEW" Then
    If Me.AgentID2.Column(2) = "T" Then
        MsgBox "AGENT " & Me.AgentID2 & " - " & UCase(Me.AgentID2.Column(1)) & vbCrLf & vbCrLf & "IS TERMINATED!", vbCritical, "ISM WARNING"
        Me.AgentID2 = ""
        Me.AgentID2.SetFocus
    End If
End If

On Error GoTo 0
Exit Sub
AgentID2_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure AgentID2_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : AgentID2_MouseUp
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub AgentID2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo AgentID2_MouseUp_Error
If X >= 1095 And X <= 1275 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.AgentName2.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If

On Error GoTo 0
Exit Sub
AgentID2_MouseUp_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure AgentID2_MouseUp of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : AgentName_MouseUp
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub AgentName_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo AgentName_MouseUp_Error
If X >= 3360 And X <= 3555 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.PrcBusagent1.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If
'MsgBox X

On Error GoTo 0
Exit Sub
AgentName_MouseUp_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure AgentName_MouseUp of VBA Document Form_frmMaster"

End Sub

Private Sub AgentName2_BeforeUpdate(Cancel As Integer)
On Error GoTo cmdClient_Click_Err
If IsNothing(Me.AgentID2) Then Exit Sub
    'DoCmd.OpenForm "frmPayor", acNormal, "", "IsmaId=" & Me.IsmaId2, , acDialog, Me.Name

cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

'---------------------------------------------------------------------------------------
' Procedure : AgentName2_MouseDown
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub AgentName2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo AgentName2_MouseDown_Error
If X >= 3360 And X <= 3585 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.Controlledbus.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If


On Error GoTo 0
Exit Sub
AgentName2_MouseDown_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure AgentName2_MouseDown of VBA Document Form_frmMaster"

End Sub


Private Sub cboCompanycodeLoanNo_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X >= 3045 And X <= 3240 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.PolicyNo.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If
'MsgBox X

End Sub

Private Sub ClientName_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo PROC_ERR
'Static intPopulate As Integer
If Me.AllowEdits Then
    If intPopulate = 0 Then
        'Me.ClientName.RowSource = "SELECT * FROM qryClientCbo"
        intPopulate = 1
      
    End If
End If

Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub ClientName_LostFocus()
On Error GoTo PROC_ERR
intPopulate = 0
'Me.ClientName.RowSource = "SELECT * FROM qryClientCbo WHERE IsmaID=" & Me.IsmaId

Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub ClientName_NotInList(NewData As String, Response As Integer)
 On Error GoTo PROC_ERR
    Dim strName As String
    Dim intReturn As Integer
   
    strName = StrConv(NewData, vbProperCase)
    intReturn = MsgBox("Client " & strName & _
        " is not in the system.  Do you want to add this Client?", _
        vbQuestion + vbYesNo, "ISM")
    If intReturn = vbYes Then
        DoCmd.OpenForm "frmClient", , , , acFormAdd, , Me.Name
        'FormName:="frmInterpreterAdd", _
            'DataMode:=acAdd, WindowMode:=acDialog, OpenArgs:=strInterpreterID
        If IsNothing(DLookup("ClientName", "qryClientNotInList", "ClientName = """ & strName & """")) Then
           Response = acDataErrContinue
        Else
            Response = acDataErrAdded
        End If
        Exit Sub
    End If
    Response = acDataErrDisplay
    Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdACHDelete_Click
' Author    : norbert
' Date      : 7/24/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub cmdACHDelete_Click()

   On Error GoTo cmdACHDelete_Click_Error

If Me.AllowEdits = False Then Exit Sub
If Me.fSubDailyACHCcard.Visible = False Then Exit Sub
If vbCancel = MsgBox("PLEASE CONFIRM TO DELETE DAILY ACH/Ccard Transaction", vbCritical + vbOKCancel, "ISM") Then
    Exit Sub
End If
DoCmd.RunSQL "DELETE * FROM tblAFInsuranceExp WHERE Masterfileno=" & Me.MasterfileNo
Me.fSubDailyACHCcard.Visible = False
Refresh



   On Error GoTo 0
   Exit Sub

cmdACHDelete_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdACHDelete_Click of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdAdd_Click
' Author    : norbert
' Date      : 5/3/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub cmdAdd_Click()
On Error GoTo cmdAdd_Click_Error
If vbCancel = MsgBox("PLEASE CONFIRM THAT YOU WANT TO COPY THIS MASTERFILE TO A NEW ONE", vbCritical + vbOKCancel, "ISM") Then
    Exit Sub
End If

'Me.AllowAdditions = True
'DoCmd.GoToRecord , , acNewRec
'If Me.IsmaId = 999999999 Then Exit Sub
'If Forms!frmClient!NoNewMaster = True Then Exit Sub
'Me.chkCopyRecord = True
DoCmd.OpenForm "frmMasterAddRepeatNo", acNormal, , , , , Me.Name

'20140318
'If Me.NoNewMaster Then Exit Sub
'If Not IsNothing(Me.txtMasterFileNo) Then
'    DoCmd.OpenForm "frmMaster", acNormal, , "MasterFileNo=" & Me.txtMasterFileNo, , acHidden, Me.Name
'Else
'If Me.chkCopyRecord = False Then
       
'    Exit Sub
'End If
'DoCmd.OpenForm "frmMaster", acNormal, , "MasterFileNo=" & Me.NewMasterFileNo, , , Me.Name


'With Forms!FRMmaster
'   !txtProcessMsg = "CAUTION THIS IS A NEW MASTERFILE"
'   .AllowEdits = True
'   !lblWarningMaster.Visible = True
'   !lblWarningMaster.Caption = "NEW"
'   '!Assoclev = "BASIC"
'   !TransmittalDate = GetSystemDate
'   .Visible = True
'End With
'Me.Refresh
'Me.chkCopyRecord = True
On Error GoTo 0
Exit Sub

cmdAdd_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdAdd_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdADDC_Click()
On Error GoTo PROC_ERR
GetUserName

With Forms!frmMaster!fSubMasterComments
     .SetFocus
     .Form.AllowEdits = True
     .Form.AllowAdditions = True
     Me.AllowAdditions = True
    
     DoCmd.GoToRecord , "", acNewRec
    
     !MastseqNo = [Forms]![frmMaster]![MasterfileNo]
     '.Refresh
     !UserNameID = Nz(DLookup("UserNameID", "tbl_LogIn"))
     !CommentsDate = Now
     'Me.fSubMasterComments!Comments.SetFocus
     !Comments.SetFocus
     .Form.AllowAdditions = False
     '!UserNameID.SetFocus
End With
Me.lblWarning.Visible = True
Me.lblWarning.Caption = "ADD!"
intMasterComments = Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
'Me.cmdGoto.Enabled = False
Me.lblComments.Caption = "Tl Comments= " & Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
'Me.Painting = True

Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub cmdAgent1_Click()
On Error GoTo cmdClient_Click_Err
If IsNothing(Me.AgentID) Then Exit Sub
    DoCmd.OpenForm "frmContracts", acNormal, "", "AgentCode='" & Me.AgentID & "'", , acDialog, Me.Name

cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

Private Sub cmdColl_Click()
On Error GoTo cmdClient_Click_Err
If Nz(DCount("*", "tblCollectionHist", "MasterFileNo=" & Me.MasterfileNo)) = 0 Then
    MsgBox "COLLECTION HISTORY HAS NO RECORDS!", vbInformation, "NO RECORDS"
     Exit Sub
End If
DoCmd.OpenForm "frmEFTHistSummary", acNormal, "", "MasterFileNo=" & Me.MasterfileNo, , acDialog, Me.Name
With Forms!frmEFTHistSummary
    !ClientName = Me.ClientName

End With
'SELECT tblCollectionHist.CollectionID, tblCollectionHist.MasterFileNo, tblCollectionHist.ColDate, tblCollectionHist.ColAmt, tblCollectionHist.ColMode, tblCollectionHist.RemitDate, tblCollectionHist.Comments
'FROM tblCollectionHist
'WHERE (((tblCollectionHist.MasterFileNo)=135629));

cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdAgent2_Click
' Author    : Norbert
' Date      : 4/6/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdAgent2_Click()
On Error GoTo cmdAgent2_Click_Error
If IsNothing(Me.AgentID2) Then Exit Sub
 DoCmd.OpenForm "frmContracts", acNormal, "", "AgentCode='" & Me.AgentID2 & "'", , acDialog, Me.Name

On Error GoTo 0
Exit Sub
cmdAgent2_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdAgent2_Click of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdCCard_Click
' Author    : Norbert
' Date      : 7/16/2013
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub cmdCCard_Click()
   On Error GoTo cmdCCard_Click_Error

If Nz(DCount("*", "tblCCardUptake", "[MSeqNo]=" & Me.MasterfileNo)) > 0 Then
    DoCmd.OpenForm "frmCCardUptake", acNormal, , "[MSeqNo]=" & Me.MasterfileNo, , , Me.Name
Else
    DoCmd.OpenForm "frmCCardUptake", acNormal, , , acFormAdd, , Me.Name
     With Forms!frmOwner
        .AllowEdits = True
        !lblWarningMaster.Visible = True
        !txtRecord.SetFocus
        !txtRecord = Me.MasterfileNo
       
     End With
End If

   On Error GoTo 0
   Exit Sub

cmdCCard_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdCCard_Click of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdCRider_Click
' Author    : Norbert
' Date      : 4/9/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdCRider_Click()
On Error GoTo cmdCRider_Click_Error
If Nz(DCount("*", "tblChildRider", "[ChildRiderPolicyNo]='" & Nz(Me.PolicyNo, "") & "'")) > 0 Then
    Me.txtNew = 0
    DoCmd.OpenForm "frmChildRider", acNormal, , "[ChildRiderPolicyNo]='" & Me.PolicyNo & "'", , , Me.Name
   
Else
    Me.txtNew = 1
    DoCmd.OpenForm "frmChildRider", acNormal, , , acFormAdd, , Me.Name
    With Forms!frmChildRider
        '.AllowEdits = True
        '.AllowAdditions = True
       
        !ChildriderpolicyNo = Me.PolicyNo
        !DayTel = Nz(DLookup("DayTel", "tblClient", "IsmaID=" & Me.IsmaId))
        !EveTel = Nz(DLookup("EveTel", "tblClient", "IsmaID=" & Me.IsmaId))
        !street = Nz(DLookup("Street", "tblClient", "IsmaID=" & Me.IsmaId))
        !Addr2 = Nz(DLookup("addr2", "tblClient", "IsmaID=" & Me.IsmaId))
        !city = Nz(DLookup("City", "tblClient", "IsmaID=" & Me.IsmaId))
        !State = Nz(DLookup("State", "tblClient", "IsmaID=" & Me.IsmaId))
        !zip = Nz(DLookup("Zip", "tblClient", "IsmaID=" & Me.IsmaId))
      
           
           
    End With
End If

On Error GoTo 0
Exit Sub
cmdCRider_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdCRider_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdDelete_Click()
On Error GoTo cmdDelete_Click_Err
Dim intRecords As Integer
'If Me.txtProcess = "MASTINAC" Or Me.txtProcess = "MASTINACVIEW" Then
'    MsgBox "NOT AVAILABLE IN MASTER INACTIVE PROCESS", vbCritical, "ISM"
'    Exit Sub
'End If
Me.RecordsetClone.MoveLast
intRecords = Me.RecordsetClone.RecordCount


If vbCancel = MsgBox("PLEASE CONFIRM TO DELETE THIS MASTER FILE", vbCritical + vbOKCancel, "DELETE MASTER FILE") Then
    Exit Sub
End If

On Error Resume Next

Me.SetFocus
DoCmd.GoToControl Screen.PreviousControl.Name
Err.Clear
Me.AllowDeletions = True
If (Not Me.NewRecord) Then
   
    DoCmd.RunCommand acCmdDeleteRecord
    If intRecords = 1 Then DoCmd.Close acForm, Me.Name
End If
If (Me.NewRecord And Not Me.Dirty) Then
    DoCmd.RunCommand acCmdDeleteRecord
    If intRecords = 1 Then DoCmd.Close acForm, Me.Name
    Beep
End If
If (Me.NewRecord And Me.Dirty) Then
    DoCmd.RunCommand acCmdUndo
End If
   
Exit Sub

cmdDelete_Click_Exit:
    Exit Sub

cmdDelete_Click_Err:
    MsgBox Error$
    Resume cmdDelete_Click_Exit

End Sub

Private Sub cmdDeleteC_Click()
On Error GoTo cmdDelete_Click_Err

If vbCancel = MsgBox("PLEASE CONFIRM TO DELETE THIS COMMENT", vbCritical + vbOKCancel, "DELETE COMMENT") Then
    Exit Sub
End If

With Forms!frmMaster!fSubMasterComments.Form
On Error Resume Next
    .SetFocus
    DoCmd.GoToControl Screen.PreviousControl.Name
    Err.Clear
    .AllowDeletions = True
    If (Not .NewRecord) Then
        DoCmd.RunCommand acCmdDeleteRecord
    End If
    If (.NewRecord And Not .Dirty) Then
         DoCmd.RunCommand acCmdDeleteRecord
        Beep
    End If
    If (.NewRecord And .Dirty) Then
        DoCmd.RunCommand acCmdUndo
    End If
    If (MacroError <> 0) Then
        Beep
        MsgBox MacroError.Description, vbOKOnly, ""
    End If
    Me.lblComments.Caption = "Tl Comments= " & Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
End With
Exit Sub

cmdDelete_Click_Exit:
    Exit Sub

cmdDelete_Click_Err:
    MsgBox Error$
    Resume cmdDelete_Click_Exit

End Sub

Private Sub cmdEdit_Click()
On Error GoTo cmdClient_Click_Err
If Me.AllowEdits Then Exit Sub
'If Me.txtProcess = "MASTINACVIEW" Then
'    MsgBox "NOT AVAILABLE IN MASTER INACTIVE VIEW PROCESS", vbCritical, "ISM"
'    Exit Sub
'End If
'If Me.Productstatus <> "INFORCE" Then
'    MsgBox "MASTERFILE INFORMATION:" & vbCrLf & _
'            vbCrLf & "PRODUCT STATUS: " & UCase(Me.Productstatus), vbCritical, "NOT INFORCE ISM WARNINIG!"
           
'ElseIf Me.IsmaProductCode <> "INSURANCE" Then
'    MsgBox "MASTERFILE INFORMATION:" & vbCrLf & _
'            vbCrLf & "PRODUCT CODE: " & UCase(Me.IsmaProductCode), vbCritical, "NOT INSURANCE ISM WARNINIG!"

'End If

'DISABLE AS PER BRENDA 051013
'If vbYes = MsgBox("NOT 'INFORCE' IS NOT AVAILABLE IN MASTER INACTIVE VIEW PROCESS" & vbCrLf & _
'       "DO YOU STILL WANT TO EDIT IT?", vbCritical + vbYesNo, "ISM") Then
'
'        Me.AllowEdits = True
'    Else
'        Exit Sub
'    End If
'End If
'
'If Me.IsmaProductCode <> "INSURANCE" Then
'   If vbYes = MsgBox("NOT 'INSURANCE' IS NOT AVAILABLE IN MASTER INACTIVE VIEW PROCESS" & _
'                "DO YOU STILL WANT TO EDIT IT?", vbCritical + vbYesNo, "ISM") Then
'        Me.AllowEdits = True
'   Else
'        Exit Sub
'
'  End If
'End If

'If Me.AgentStatus.Column(2) = "T" Then
'            MsgBox "AGENT1 (" & UCase(Me.AgentID.Column(1)) & ") IS TERMINATED" & vbCrLf & vbCrLf & "MASTERFILE#: " & Me.MasterfileNo, vbCritical, "EDIT MASTERFILE"
'
'            'If vbYes = MsgBox("AGENT (" & UCase(Me.AgentID.Column(1)) & ") IS TERMINATED" & vbCrLf & vbCrLf _
'            '                           & "DO YOU WANT TO DELETE MASTERFILE#: " & Me.MasterfileNo & "?", vbCritical + vbYesNo, "ISM") Then
'            '    Call cmdDelete_Click
'            '   Exit Sub
'            'End If
'ElseIf Me.AgentStatus2.Column(2) = "T" Then
'             MsgBox "AGENT2 (" & UCase(Me.AgentID2.Column(1)) & ") IS TERMINATED" & vbCrLf & vbCrLf & "MASTERFILE#: " & Me.MasterfileNo, vbCritical, "EDIT MASTERFILE"
'            'If vbYes = MsgBox("AGENT (" & UCase(Me.AgentID2.Column(1)) & ") IS TERMINATED" & vbCrLf & vbCrLf _
'            '                           & "DO YOU WANT TO DELETE THIS MASTERFILE#: " & Me.MasterfileNo & "?", vbCritical + vbYesNo, "ISM") Then
'            '    Call cmdDelete_Click
'            'Exit Sub
'            'End If
'
'End If
'---------------------------------------------------------------------------------------------------------------------------------------------------------
Me.AllowEdits = True
Me.cmdSave.Visible = True
Me.lblWarningMaster.Visible = True
Me.lblWarningMaster.Caption = "EDIT!"
Me.cmdSave.Visible = True
'Me.Assocmfn.SetFocus
cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit
End Sub

Private Sub cmdEditC_Click()
On Error GoTo PROC_ERR
Dim intLenght As Integer

With Forms!frmMaster!fSubMasterComments
     .SetFocus
     .Form.AllowEdits = True
     intLenght = Nz(Len(!Comments) + 1)
     !Comments.SetFocus
     !Comments.SelStart = intLenght
     !Comments.SetFocus
     '!UserNameID.SetFocus
End With
Me.lblWarning.Visible = True
Me.lblWarning.Caption = "EDIT"
'Me.cmdGoto.Enabled = False
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub cmdFA_Click()
On Error GoTo cmdClient_Click_Err
If Nz(DCount("*", "tblFAHistory", "MasterseqNo=" & Me.MasterfileNo)) = 0 Then
    MsgBox "FA HISTORY HAS NO RECORDS!", vbInformation, "NO RECORDS"
     Exit Sub
End If
DoCmd.OpenForm "frmFAHistSummary", acNormal, "", "[MasterseqNo]=" & Me.MasterfileNo, , , Me.Name
With Forms!frmFAHistSummary
    !ClientName = Me.ClientName

End With

cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdEmp_Click
' Author    : Norbert
' Date      : 5/31/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdEmp_Click()
On Error GoTo cmdEmp_Click_Error
If IsNothing(Me.IsmaId3) Then
    DoCmd.OpenForm "frmEmployer", acNormal, "", , , acDialog, Me.Name
Else
    DoCmd.OpenForm "frmEmployer", acNormal, "", "GroupID=" & Me.IsmaId3, , acDialog, Me.Name
End If
On Error GoTo 0
Exit Sub
cmdEmp_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdEmp_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdGoto_Click()
On Error GoTo PROC_ERR
Dim intCt As Integer
'DoCmd.Echo False
Static staticCt
intCt = 0
staticCt = 0
'DoEvents
'DoCmd.Echo False
'Application.Echo False
'Me.Painting = False
'DoCmd.Hourglass True
'Me.Application.ScreenUpdating = False
'Me.Painting = False

'Me.Application.Screen False
'onload caption is Comments and can't have all the other comments functions
intMasterComments = Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
If Me.cmdGoto.Caption = "MASTER" Then
    CommentsMaster (1)
    Me.cmdGoto.Caption = "COMMENTS"
        If intMasterComments = 0 Then
            Call cmdADDC_Click
            Forms!frmMaster!fSubMasterComments.SetFocus
            On Error Resume Next
            Forms!frmMaster!fSubMasterComments!Comments.SetFocus
        Else
             DoEvents
             Forms!frmMaster!fSubMasterComments.SetFocus
             Forms!frmMaster!fSubMasterComments!Comments.SetFocus
             DoCmd.GoToRecord , , acFirst
             Forms!frmMaster!fSubMasterComments!Comments.SelStart = Nz(Len(Forms!frmMaster!fSubMasterComments!Comments))
        End If
Else
    CommentsMaster (0)
    Me.cmdGoto.Caption = "MASTER"
    Me.Assocmfn.SetFocus
    'Call cmdOK_Click
End If
'DoCmd.Echo True
'Application.Echo True
'Exit Sub

'If Me.cmdGoto.Caption = "COMMENTS" And Me.BoxC.Visible = True Then
'   Call cmdOK_Click
'End If
   
'    Me.SetFocus
'    Me.Assocmfn.SetFocus
'    Me.cmdGoto.Caption = "MASTER"
'    CommentsMaster (0)
'
'ElseIf Me.cmdGoto.Caption = "COMMENTS" And intMasterComments = 0 Then
'    With Forms!frmMaster!fSubMasterComments
'        .SetFocus
'
'       On Error Resume Next
'    .AllowAdditions = True
'    DoCmd.GoToRecord , "", acNewRec
'       'DoCmd.GoToRecord , , acNewRec
'       !UserNameID.SetFocus
'        Me.cmdGoto.Caption = "COMMENTS"
'        If GetUserPermission(GetUserName) = 1 Then
'            CommentsMaster (1)
'        Else
'            CommentsMaster (0)
'        End If
'        DoCmd.GoToRecord , , acLast
'End With
'End If
'Me.Painting = True
'DoCmd.Hourglass False
Exit Sub
   
PROC_ERR:
    If Err = 2105 Then
    Me.Assocmfn.SetFocus
    Exit Sub
    End If
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub cmdIns_Click()
On Error GoTo cmdClient_Click_Err
If IsNothing(Me.CompanycodeLoanNo) Then Exit Sub
    DoCmd.OpenForm "frmVendorLender", acNormal, "", "CompanycodeLoanNo='" & Me.CompanycodeLoanNo & "'", , acDialog, Me.Name


cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdMulti_Click
' Author    : Norbert
' Date      : 4/3/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdMulti_Click()
On Error GoTo cmdMulti_Click_Error
DoCmd.OpenForm "frmMultiSearch", , , , , , Me.Name

On Error GoTo 0
Exit Sub
cmdMulti_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdMulti_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdOK_Click()
On Error GoTo PROC_ERR
With Forms!frmMaster!fSubMasterComments.Form
     '.SetFocus
   .AllowEdits = False
   Me.AllowDeletions = True
   If Nz(Len(Forms!frmMaster!fSubMasterComments.Form!Comments)) = 0 Then
        DoCmd.GoToControl Screen.PreviousControl.Name
        Err.Clear
        .AllowDeletions = True
        DoCmd.RunCommand acCmdDeleteRecord
   End If
  
'   If (Not .NewRecord) Then
'      '  .SetFocus
'        DoCmd.GoToControl Screen.PreviousControl.Name
'        Err.Clear
'        .AllowDeletions = True
'        DoCmd.RunCommand acCmdDeleteRecord
'    End If
   
   
   
'    If IsNothing(!Comments) Then
'        If (.NewRecord And .Dirty) Then
'            DoCmd.RunCommand acCmdUndo
'        End If
'
'    End If
'     .Undo
    
'     If Nz(Len(!Comments)) = 0 Then
'        .AllowDeletions = True
'        .SetFocus
'        DoCmd.RunCommand acCmdDeleteRecord
'     End If
     'DoCmd.RunCommand acCmdUndo
     Me.AllowDeletions = False
    .AllowEdits = False
    .AllowDeletions = False
    .AllowAdditions = False
End With
Me.lblWarning.Visible = False
Me.Assocmfn.SetFocus
Me.cmdGoto.Caption = "MASTER"
Me.cmdGoto.Enabled = True
CommentsMaster (0)
Me.lblComments.Caption = "Tl Comments= " & Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdOwner_Click
' Author    : Norbert
' Date      : 4/9/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdOwner_Click()
On Error GoTo cmdOwner_Click_Error
If Nz(DCount("*", "tblOwner", "[OwnerPolicyNo]='" & Nz(Me.PolicyNo, "") & "'")) > 0 Then
    DoCmd.OpenForm "frmOwner", acNormal, , "[OwnerPolicyNo]='" & Me.PolicyNo & "'", , acDialog, Me.Name
Else
    DoCmd.OpenForm "frmOwner", acNormal, , , acFormAdd, , Me.Name
     With Forms!frmOwner
        .AllowEdits = True
        !lblWarningMaster.Visible = True
        !OwnerID.SetFocus
        !OwnerpolicyNo = Me.PolicyNo
       
     End With
End If
On Error GoTo 0
Exit Sub
cmdOwner_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdOwner_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdPayor_Click()
On Error GoTo cmdClient_Click_Err
If IsNothing(Me.IsmaId2) Then Exit Sub
     If Nz(DCount("*", "tblPayor", "IsmaID=" & Me.IsmaId2)) = 0 Then Exit Sub
    
     DoCmd.OpenForm "frmPayor", acNormal, , "IsmaId=" & Me.IsmaId2 ', , , Me.Name
cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

Private Sub cmdPDFFiles_Click()
On Error GoTo cmdClient_Click_Err
If Nz(DCount("*", "qryEODReportsPDFMasterFiles", "FileID='" & Me.MasterfileNo & "'")) = 0 Then
    DoCmd.OpenForm "frmScanMasterfile", acNormal, , , acFormAdd, , Me.Name
    If Me.lblApplication.Visible = True Then
        With Forms!FRMSCANMASTERFILE
            !cboScanType = 4
            !NBAppsClientName = JoinNBAPPSName(Nz(DLookup("LastName", "tblClient", "IsmaID=" & Me.txtSSN)), Nz(DLookup("MiddleName", "tblClient", "IsmaID=" & Me.txtSSN), ""), Nz(DLookup("FirstName", "tblClient", "IsmaID=" & Me.txtSSN)))
            !nbaappspolicyno = Me.PolicyNo
            !cmdScan.SetFocus
        End With
    End If
Else

DoCmd.OpenForm "frmScanMasterfile", acNormal, "", "FileID='" & Me.MasterfileNo & "'", , , Me.Name
End If
With Forms!FRMSCANMASTERFILE
    !NBAppsClientName = JoinNBAPPSName(Nz(DLookup("LastName", "tblClient", "IsmaID=" & Me.txtSSN)), Nz(DLookup("MiddleName", "tblClient", "IsmaID=" & Me.txtSSN), ""), Nz(DLookup("FirstName", "tblClient", "IsmaID=" & Me.txtSSN)))
    !NBAppsPolicyNo = Me.PolicyNo
End With
'With Forms!frmScanMasterfile

    '.AllowAdditions = True
    '!ClientName = Me.ClientName
 '   !MasterfileNo = Me.MasterfileNo
   
  '  !ClientName = "CLIENT NAME: " & Me.ClientName
   
'End With
cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit
End Sub

Private Sub cmdRemitHist_Click()
On Error GoTo cmdClient_Click_Err
If Nz(DCount("*", "tblRemitHist", "MSeqNo=" & Me.MasterfileNo)) = 0 Then
    MsgBox "REMIT HISTORY HAS NO RECORDS!", vbInformation, "NO RECORDS"
     Exit Sub
End If
DoCmd.OpenForm "frmRemitHistSummary", acNormal, "", "[MseqNo]=" & Me.MasterfileNo, , acDialog, Me.Name
With Forms!frmRemitHistSummary
    !ClientName = Me.ClientName

End With

cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdPol_Click
' Author    : norbert
' Date      : 4/24/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub cmdPol_Click()
On Error GoTo cmdPol_Click_Error
DoCmd.OpenForm "frmPolicyNumber", , , , , , Me.Name
 

On Error GoTo 0
Exit Sub

cmdPol_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdPol_Click of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdPrintIns_Click
' Author    : norbert
' Date      : 5/7/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub cmdPrintIns_Click()
   On Error GoTo cmdPrintIns_Click_Error

DoCmd.OpenReport "rptFSLCerPolPrtLbl", acViewPreview, , , , Me.PolicyNo
              '20141003 AS per Zulema, Carlos, Vicky
              DoCmd.PrintOut , , , acHigh, 2
              DoCmd.Close acReport, "rptFSLCerPolPrtLbl", acSaveYes

If vbYes = MsgBox("PLEASE CONFIRM THAT POLICY# " & Me.PolicyNo & " LABEL IS PRINTED FOR MASTERFILENO= " & Me.MasterfileNo _
               , vbYesNo + vbInformation, "ISM") Then
              
End If

   On Error GoTo 0
   Exit Sub

cmdPrintIns_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdPrintIns_Click of VBA Document Form_frmMaster"
              
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdSave_Click
' Author    : Norbert
' Date      : 4/7/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdSave_Click()
On Error GoTo cmdSave_Click_Error
'Dim lgAmt As Long

If NeedInfo Then Exit Sub

DerivedMasterFields
If Not Me.Dirty Then
    Exit Sub
Else

If Me.AllowEdits Then
    'derived field 20140109
   ' lgAmt = Nz(Me.Cwaamtrec, 0) - Nz(Me.EFTCustodialFee, 0) - Nz(Me.Prdcustodialfee, 0) - Nz(Me.DBCustodialFee, 0) - Nz(Me.Bookmark, 0)
    'Me.Cwaamttoremit = IIf(Me.IsmaProductCode <> "Association", IIf(lgAmt > 0 And Me.Cwaremitdate = "", lgAmt, ""), Me.Cwaamtrec)
'If Me.lblSaved.Caption = "RECORD DELETED" Then Exit Sub
    'DoCmd.Save acForm, Me.Name
   
   
   
    RunCommand acCmdSaveRecord
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.lblWarningMaster.Visible = True
    Me.lblWarningMaster.ForeColor = vbGreen
    Me.lblWarningMaster.Caption = "SAVED"
    Me.AllowEdits = False
End If
'this command refresh and clears Openargs
'DoCmd.RunCommand acCmdSave
End If
On Error GoTo 0
Exit Sub
cmdSave_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSave_Click of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdSecIns_Click
' Author    : Norbert
' Date      : 4/9/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub cmdSecIns_Click()
On Error GoTo cmdSecIns_Click_Error
If Nz(DCount("*", "tblTermrider", "[PolNumber]='" & Nz(Me.PolicyNo, "") & "'")) > 0 Then
    DoCmd.OpenForm "frmTermRider", acNormal, , "[PolNumber]='" & Me.PolicyNo & "'", , acDialog, Me.Name
Else
    DoCmd.OpenForm "frmTermRider", acNormal, , , acFormAdd, , Me.Name
    With Forms!frmTermRider
        !RelMSeq = Me.MasterfileNo
        !PolNumber = Me.PolicyNo
        .SetFocus
    End With
End If


On Error GoTo 0
Exit Sub
cmdSecIns_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSecIns_Click of VBA Document Form_frmMaster"
End Sub

Private Sub cmdTransfer_Click()
On Error GoTo cmdClient_Click_Err
Dim intUserID As Integer

Dim dbsDB As Database
Dim rstRS As DAO.Recordset
Dim strWhere As String
Dim strSQL As String
If IsNothing(Me.Comments) Then Exit Sub
Set dbsDB = CurrentDb
       
strSQL = "SELECT * FROM qryMasterComments where Mastseqno=" & Me.MasterfileNo
Set rstRS = dbsDB.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
With rstRS
   If .RecordCount > 0 Then
       .FindFirst "Comments ='" & Me.Comments & "'"
       If Not .NoMatch Then
             If vbYes = MsgBox("COMMENT(s): " & Me.Comments & vbCrLf & vbCrLf & " ALREADY IN 'MASTER COMMENTS' DATED: " _
                    & !CommentsDate & vbCrLf & vbCrLf & "ENTER 'YES' TO REMOVE COMMENT(s) HERE", vbCritical + vbYesNo, "DUPLICATE COMMENT(s)") Then
                    Me.Comments = ""
                    Refresh
             End If
       Else
'             If vbYes = MsgBox("COMMENT(s): " & Me.Comments & vbCrLf & vbCrLf & " WILL BE MOVED TO THE MASTER COMMENTS" _
'                        & vbCrLf & vbCrLf & "ENTER 'YES' TO REMOVE COMMENT(s) HERE", vbCritical + vbYesNo, "MOVE COMMENT(s) TO 'MASTER COMMENTS'") Then
'                    Me.Comments = ""
'                    'Refresh
'
'            End If
'            intUserID = Nz(DLookup("UserNameID", "tbl_LogIn"))
            DoCmd.RunSQL "INSERT INTO tblmastcomments ( MastseqNo, UserNameID, CommentsDate, Comments ) SELECT " _
                          & (Me.MasterfileNo & "," & intUserID & ",#" & Date & "#," & "'" & Me.Comments & "'")
            Me.Comments = ""
            Refresh
       End If
    ElseIf .RecordCount = 0 Then
        intUserID = Nz(DLookup("UserNameID", "tbl_LogIn"))
            DoCmd.RunSQL "INSERT INTO tblmastcomments ( MastseqNo, UserNameID, CommentsDate, Comments ) SELECT " _
                          & (Me.MasterfileNo & "," & intUserID & ",#" & Date & "#," & "'" & Me.Comments & "'")
            Me.Comments = ""
            Refresh
   
   
    End If
    .Close
End With

cmdClient_Click_Exit:
    Exit Sub
cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

Private Sub CollectionMode_AfterUpdate()
On Error GoTo cmdClient_Click_Err
'Procedure to load the dif collection modes 10/3/11
    Me.PriorCollMode = Me.ActiveControl.OldValue
    CollectionModes

'derived field 10140109
DoCmd.RunSQL "UPDATE tblPRDBillingHistory SET CollectMode='" & Me.CollectionMode & "' WHERE MasterSeqNo=" & Me.MasterfileNo
'If Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
'    If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
'        Me.CustodialBank = "AF"
'    Else
'        MsgBox "SELECT A DIFFERENT CUSTODIAL BANK", vbCritical, "ISM"
'        Me.CustodialBank.SetFocus
'
'    End If
'End If

If Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
    If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Or Me.CollectionMode = "Direct Bill" Or Me.CollectionMode = "PRD" Then
        Me.CustodialBank = "AF"
'    Else
'        MsgBox "SELECT A DIFFERENT CUSTODIAL BANK", vbCritical, "ISM"
'        Me.CustodialBank.SetFocus
'        Exit Sub
    End If
End If
'072213 default today() as per Sue to eliminate Scan Text for not equal...... changed 20140325
'Me.TransmittalDate = Date
'Me.PreNoteDate = Date

'---------------------------------------------
cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit
End Sub

'---------------------------------------------------------------------------------------
' Procedure : CollectionMode_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub CollectionMode_Change()
On Error GoTo CollectionMode_Change_Error
If Me.IsmaIdAssWeb.Visible = True Then
    Me.IsmaIdAssWeb.SetFocus
Else
    Me.ApplicationDate.SetFocus
End If
On Error GoTo 0
Exit Sub
CollectionMode_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CollectionMode_Change of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : CompanycodeLoanNo_AfterUpdate
' Author    : Norbert
' Date      : 5/12/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub CompanycodeLoanNo_AfterUpdate()
Dim strName As String
On Error GoTo CompanycodeLoanNo_AfterUpdate_Error
Me.ActiveControl = StrConv(Me.ActiveControl, vbUpperCase)
strName = Nz(DLookup("CompanyName", "tblVendLend", "CompanycodeLoanNo='" & Me.ActiveControl & "'"))
'If Not IsNothing(strName) Then
'    MsgBox "VENDOR: " & UCase(Me.ActiveControl) & "  IS ASSIGNED TO " & UCase(strName) & vbCrLf & vbCrLf & _
'            "PLEASE!-ENTER A DIFFERENT CODE FOR VENDOR: " & UCase(Me.ActiveControl) & " AGAIN OR EXIT", vbCritical, "WARNING DUPLICATE VENDOR!"
'
'    Me.ActiveControl = ""
'    Me.ActiveControl.SetFocus
'    Exit Sub
'End If

If Nz(DCount("CompanyName", "tblVendLend", "CompanycodeLoanNo='" & Me.ActiveControl & "'")) > 0 Then
  'Cancel = True
        If Me.ActiveControl = Me.ActiveControl.OldValue Then
            If MsgBox("THIS CODE BELONGS TO: " & vbCrLf & strName & vbCrLf & _
                      "CONFIRM IF CORRECT", vbQuestion + vbYesNo, "ISM") = vbYes Then
            Else
                Me.ActiveControl = ""
                Me.ActiveControl.SetFocus
            End If
       
        Else
            If Not IsNothing(Me.ActiveControl.OldValue) Then
            If MsgBox("VENDOR CODE WILL BE CHANGED" & vbCrLf & vbCrLf & "FROM: " & Me.ActiveControl.OldValue & "----TO: " & Me.ActiveControl & "?" & _
                        vbCrLf & vbCrLf & "IS THIS CORRECT?", vbQuestion + vbYesNo, "ISM") = vbYes Then
               Refresh
               If Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
                    If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
                        Me.CustodialBank = "AF"
                    End If
               End If
               Exit Sub
            End If
            End If
       End If
 
Else
    DoCmd.OpenForm "frmVendorLender", , , , acFormAdd, acDialog, Me.ActiveControl
End If
If Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
     If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
         Me.CustodialBank = "AF"
    
     End If
End If
On Error GoTo 0
Exit Sub
CompanycodeLoanNo_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CompanycodeLoanNo_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : CompanycodeLoanNo_MouseUp
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub CompanycodeLoanNo_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo CompanycodeLoanNo_MouseUp_Error
If X >= 1410 And X <= 1605 Then
    'Me.CompanycodeLoanNo.Dropdown
    Me.cboCompanycodeLoanNo.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If
'MsgBox X

On Error GoTo 0
Exit Sub
CompanycodeLoanNo_MouseUp_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CompanycodeLoanNo_MouseUp of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : Critillrider_AfterUpdate
' Author    : norbert
' Date      : 5/1/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Critillrider_AfterUpdate()
   On Error GoTo Critillrider_AfterUpdate_Error

If IsNothing(Me.Critillrider) Then Me.Critillrider = "NO"

   On Error GoTo 0
   Exit Sub

Critillrider_AfterUpdate_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Critillrider_AfterUpdate of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Custodialbank_LostFocus
' Author    : norbert
' Date      : 9/23/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Custodialbank_LostFocus()
   On Error GoTo Custodialbank_LostFocus_Error

If Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
    If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
        Me.CustodialBank = "AF"
    Else
        If Me.CustodialBank = "AF" Then
       
            MsgBox "SELECT A DIFFERENT CUSTODIAL BANK NOT 'AF'", vbCritical, "ISM"
            Me.CustodialBank.SetFocus
       
        Exit Sub
        End If
    End If
End If

   On Error GoTo 0
   Exit Sub

Custodialbank_LostFocus_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Custodialbank_LostFocus of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : DbCustodialFee_AfterUpdate
' Author    : Norbert
' Date      : 10/12/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub DbCustodialFee_AfterUpdate()
On Error GoTo DbCustodialFee_AfterUpdate_Error
'20140815
Me.RemittancePmtAmt = Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)
Me.Dbremitamt = IIf(Me.prodcde <> "Association", IIf((Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)) > 0 And IsNothing(Me.Dbremitteddate) _
                    , Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0), 0), Nz(Me.DBGrossBillAmt, 0))
On Error GoTo 0
Exit Sub
DbCustodialFee_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure DbCustodialFee_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : Dbgrossbillamt_AfterUpdate
' Author    : Norbert
' Date      : 5/31/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Dbgrossbillamt_AfterUpdate()
On Error GoTo Dbgrossbillamt_AfterUpdate_Error
'20140814
Me.RemittancePmtAmt = Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)
Me.Dbremitamt = IIf(Me.prodcde <> "Association", IIf((Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)) > 0 And IsNothing(Me.Dbremitteddate) _
                    , Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0), 0), Nz(Me.DBGrossBillAmt, 0))
On Error GoTo 0
Exit Sub
Dbgrossbillamt_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Dbgrossbillamt_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : DeductionCycle_AfterUpdate
' Author    : Norbert
' Date      : 2/6/2014
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub DeductionCycle_AfterUpdate()

On Error GoTo DeductionCycle_AfterUpdate_Error

DerivedMasterFields
On Error GoTo 0
Exit Sub
DeductionCycle_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure DeductionCycle_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Effectivedate_AfterUpdate
' Author    : norbert
' Date      : 8/8/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Effectivedate_AfterUpdate()
On Error GoTo Effectivedate_AfterUpdate_Error

Me.DBNextBillDate = IIf(Not IsNothing(Me.Effectivedate), IIf(IsNothing(Me.Dblastbilldate), DateAdd("m", 11, Me.Effectivedate), DateAdd("yyyy", 1, Me.Dblastbilldate)), Null)

   On Error GoTo 0
   Exit Sub

Effectivedate_AfterUpdate_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Effectivedate_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Eftcomments_AfterUpdate
' Author    : Norbert
' Date      : 5/8/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Eftcomments_AfterUpdate()
On Error GoTo Eftcomments_AfterUpdate_Error
Me.Eftasofdate.Visible = True
Me.Eftasofdate = Date

On Error GoTo 0
Exit Sub
Eftcomments_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Eftcomments_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Eftcustodialfee_AfterUpdate
' Author    : Norbert
' Date      : 10/6/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Eftcustodialfee_AfterUpdate()
On Error GoTo Eftcustodialfee_AfterUpdate_Error
'20140814
Me.RemittancePmtAmt = Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0)

On Error GoTo 0
Exit Sub
Eftcustodialfee_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Eftcustodialfee_AfterUpdate of VBA Document Form_frmMaster"

End Sub


'---------------------------------------------------------------------------------------
' Procedure : Eftgrosscollamt_AfterUpdate
' Author    : Norbert
' Date      : 5/31/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Eftgrosscollamt_AfterUpdate()
On Error GoTo Eftgrosscollamt_AfterUpdate_Error
Me.RemittancePmtAmt = Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0)

On Error GoTo 0
Exit Sub
Eftgrosscollamt_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Eftgrosscollamt_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Flexoption_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Flexoption_Change()
On Error GoTo Flexoption_Change_Error
Me.WantsFund.SetFocus

On Error GoTo 0
Exit Sub
Flexoption_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Flexoption_Change of VBA Document Form_frmMaster"
End Sub


'---------------------------------------------------------------------------------------
' Procedure : Form_BeforeUpdate
' Author    : Norbert
' Date      : 5/19/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)

On Error GoTo Form_BeforeUpdate_Error
If Me.Dirty Then Me.lblWarningChange.Visible = False
'If Me.AllowEdits Then Me.lblWarningMaster.Caption = "EDIT!"
If Me.NewRecord Then
        Call AuditChanges("MasterFileNo", "NEW", "Audit")
Else
        Call AuditChanges("MasterFileNo", "EDIT", "Audit")
End If

On Error GoTo 0
Exit Sub
Form_BeforeUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_BeforeUpdate of VBA Document Form_frmMaster"
End Sub
Private Sub Form_Close()
On Error GoTo PROC_ERR
'MsgBox "hola"
If IsLoaded("frmPrtCWANSFLtrSearch") Then
    With Forms!frmPrtCWANSFLtrSearch
        !txtMasterFileNo = Me.MasterfileNo
        !txtClientName = Me.ClientName
        If IsLoaded("frmMasterSummary") Then DoCmd.Close acForm, "frmMasterSummary"
        .SetFocus
        '!CollectionMode = Me.CollectionMode
        '!PolicyNo = Me.PolicyNo
        !txtMsg = "PRINT SIX CWA NSF LETTER FOR MASTERFILENO: " & Me.MasterfileNo
    End With
    Exit Sub
    'GoTo PRIORFRM
End If


If IsLoaded("frmSixYrEFTLtrSearch") Then
    With Forms!frmSixYrEFTLtrSearch
        !MasterfileNo = Me.MasterfileNo
        !Productstatus = Me.Productstatus
        !CollectionMode = Me.CollectionMode
        !PolicyNo = Me.PolicyNo
        !txtMsg = "PRINT SIX YEAR LETTER FOR POLICY# " & !PolicyNo
    End With
    GoTo PRIORFRM
End If


If IsLoaded("frmFSLTenYrCtl") Then
    With Forms!frmFSLTenYrCtl
        '20140502
        !MasterfileNo = Me.MasterfileNo
        !txtNxtCollDate1 = Me.Nextcollectiondate
        !CustodialFee = Me.EFTCustodialFee
        !ISMCollMode = Me.CollectionMode
        If Me.CollectionMode = "Fed Allot" Then
            !txtNxtCollDate1.Visible = False
        Else
            !txtNxtCollDate1.Visible = True
        End If
        '!txtMsg = "PRINT FSL TEN YEAR LETTER FOR POLICY# " & !PolPrefix
    End With
End If
'20140529
If IsLoaded("frmProTenYrSingCtlSearch") Then
    With Forms!frmProTenYrSingCtlSearch
        !MasterfileNo = Me.MasterfileNo
        !MasterfileNo = Me.MasterfileNo
        !txtNxtCollDate = Me.Nextcollectiondate
        !CustodialFee = Me.EFTCustodialFee
        !txtMsg = "PRINT YEAR LETTER(s) FOR POLICY# " & !PolicyNo
    End With
End If

'If IsLoaded("frmProTenYrCtl") Then
'    With Forms!frmProTenYrCtl
'        '!MasterFileNo = Me.MasterFileNo
'        !txtMsg = "PRINT TEN YEAR LETTER FOR POLICY# " & !PolicyNo
'    End With
'End If
If IsLoaded("frmComboSixYrPrm") Then
    With Forms!frmComboSixYrPrm
        '!MasterFileNo = Me.MasterFileNo
        !DBGrossBillAmt = Me.DBGrossBillAmt
        !DBNextBillDate = Me.DBNextBillDate
        !txtMsg = "PRINT SIX YEAR LETTER FOR POLICY# " & !PolicyNo
    End With
End If

If IsLoaded("frmMakeMastInacCtlSummary") Then
    If Forms!frmMakeMastInacctlSummary!txtProcess = "MASTINACVIEW" Then
        GoTo PRIORFRM
    End If
End If
If IsLoaded("frmMasterClientSearch") Then
        If Forms!frmMasterClientSearch!txtProcess = "MASTINAC" Then
            If IsLoaded("frmMasterSummary") Then
                DoCmd.Close acForm, "frmMasterSummary"
            End If
            'NOT NECESSARY JUST TO REVIEW THE MASTER FILE 050113
'            If Nz(DCount("*", "tblInactiveMast", "MasterSeqNo=" & Me.MasterfileNo)) > 0 Then
'                MsgBox "THIS IS A DUPLICATE ENTRY." & vbCrLf & "PLEASE TRY AGAIN.", vbCritical, "ISM"
'                 GoTo PRIORFRM
'                Exit Sub
'            End If
            If IsLoaded("frmMasterClientSearch") Then
                 POPULATEFRMMASTERCLIENTSEARCH '--------------------20140411
                 Exit Sub
               
                'as per Sue does not need this condition 051613
                'If Me.Productstatus = "Withdrawn" And Not IsNothing(Me.Policycancelreason) Then
                  
                     'GoTo PRIORFRM
                'Else
                    'added 043013
                 '   If Forms!frmMasterclientSearch.Visible = True Then Forms!frmMasterclientSearch.Visible = False
                  '  MsgBox "POLICY MUST BE 'Withdrawn' with a POLICY CANCEL REASEON", vbCritical, "ISM"
                   '  GoTo PRIORFRM
                    'Exit Sub
                'End If
            End If
        End If
End If
If IsLoaded("frmMasterSummary") Then
    With Forms!frmMasterSummary
        .SetFocus
        !cmdContract.SetFocus
    End With
Else
    'When press cmdSave clears the OpenArg use txtOpenArgHold
    If Not IsNothing(Me.OpenArgs) Then
        If Me.OpenArgs = "frmMasterClientSearch" Then Forms!frmMasterClientSearch!lblMaster.Caption _
                                = "MASTER-Last Master File No=" & NowMasterfileNo

    Else
        If Me.txtOpenArgHold = "frmMasterClientSearch" Then Forms!frmMasterClientSearch!lblMaster.Caption _
                                = "MASTER-Last Master File No=" & NowMasterfileNo
    End If
End If
PRIORFRM:
    'To take care of HL02-Onl-NSF-LTR
    If IsLoaded("frmHL02OnlNSFLtrSearch") Then
        FocusFrm ("frmHL02OnlNSFLtrSearch")
    'To take care of PA03-Onl-STOP-LTR
    ElseIf IsLoaded("frmPA03OnlStopLtrSearch") Then
        FocusFrm ("frmPA03OnlStopLtrSearch")
    'To take care of PA04-Onl-closed-AC
    ElseIf IsLoaded("frmPA04OnlClosedAcSearch") Then
        FocusFrm ("frmPA04OnlClosedAcSearch")
    ElseIf IsLoaded("frmSelFSLRelRecsSearch") Then
        FocusFrm ("frmSelFSLRelRecsSearch")
    ElseIf IsLoaded("frmOnlFSLNewBkXtraSearch") Then
        FocusFrm ("frmOnlFSLNewBkXtraSearch")
   
   
    Else
        If Not IsNothing(Me.OpenArgs) Then
            FocusFrm (Me.OpenArgs)
            If IsLoaded("frmClient") Then Forms!FRMCLIENT.Form.fSubAgentsContracts!cmdContract.SetFocus
        ElseIf Not IsNothing(Me.txtOpenArgHold) Then
            FocusFrm (Me.txtOpenArgHold)
        ElseIf IsLoaded("frmMasterClientSearch") Then
            FocusFrm ("frmMasterClientSearch")
       
       
        End If
    End If
    '--------------------------------------------------------------
  
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next

End Sub
Private Sub Form_Current()
On Error GoTo PROC_ERR
'20140116 in AA trip to Miam
'If Nz(DCount("*", "tblAFInsuranceExp", "MasterfileNo=" & Me.MasterFileNo)) > 0 Then
'    Me.tgACHAccard.Caption = "DAILY ACH/Ccard"
'    Me.fSubDailyACHCcard.Form.Visible = True
'Else
'    Me.tgACHAccard.Caption = "NOT DAILY ACH/Ccard"
'    Me.fSubDailyACHCcard.Form.Visible = False
'End If
'If Forms!frmmaster!fSubDailyACHCcard!ACHCcard = True Then
'    Forms!frmmaster!fSubDailyACHCcard.Visible = True
'Else
'    Forms!frmmaster!fSubDailyACHCcard.Visible = False
'End If

'If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
'    If !ACHCcard = True Then Exit Sub

'20140808------------update dbnextbilldate
'20140814
If Me.CollectionMode = "EFT" Or Me.CollectionMode = "Fed Allot" Or Me.CollectionMode = "CCard" Then
    If Me.RemittancePmtAmt <> Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0) Then Me.RemittancePmtAmt = Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0)
ElseIf Me.CollectionMode = "PRD" Then
    If Me.RemittancePmtAmt <> Nz(Me.Prdgrosscollamt, 0) - Nz(Me.Prdcustodialfee, 0) Then Me.RemittancePmtAmt = Nz(Me.Prdgrosscollamt, 0) - Nz(Me.Prdcustodialfee, 0)
Else
  If Me.RemittancePmtAmt <> Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0) Then Me.RemittancePmtAmt = Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)
  If Me.Dbremitamt <> IIf(Me.prodcde <> "Association", IIf((Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)) > 0 And IsNothing(Me.Dbremitteddate) _
                    , Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0), 0), Nz(Me.DBGrossBillAmt, 0)) Then Me.Dbremitamt = IIf(Me.prodcde <> "Association", IIf((Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0)) > 0 And IsNothing(Me.Dbremitteddate) _
                    , Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0), 0), Nz(Me.DBGrossBillAmt, 0))
End If
If Me.DBNextBillDate <> IIf(Not IsNothing(Me.Effectivedate), IIf(IsNothing(Me.Dblastbilldate), DateAdd("m", 11, Me.Effectivedate), DateAdd("yyyy", 1, Me.Dblastbilldate)), Null) Then
    Me.DBNextBillDate = IIf(Not IsNothing(Me.Effectivedate), IIf(IsNothing(Me.Dblastbilldate), DateAdd("m", 11, Me.Effectivedate), DateAdd("yyyy", 1, Me.Dblastbilldate)), Null)
End If

'----------------------------------------------------
If Me.MasterfileNo = Me.txtMasterFileNo Then
    Me.MasterfileNo.BackColor = vbWhite
    Me.MasterfileNo.ForeColor = vbBlue
Else
    Me.MasterfileNo.BackColor = vbRed
    Me.MasterfileNo.ForeColor = vbWhite

End If


'for missing fields when save or exit 050713
'AS PER BRENDA 051013 DON'T NEED IT
'If Not IsNothing(Me.Lastremittancedate) Then
'    Me.lblFirstRemDate.Visible = False
'Else
'    Me.lblFirstRemDate.Visible = True
'End If
'-------------------------------------------------



'as per Brenda needs the comments 070513
'If IsNothing(Me.Comments) Then
'    Me.cmdTransfer.Visible = False
'    Me.Comments.Visible = False
'Else
'    Me.cmdTransfer.Visible = True
'    Me.Comments.Visible = True
'End If
'Procedure to load the dif collection modes 10/3/11
CollectionModes
'Procedure to load the dif Product Codes 10/4/11
ProductCodeCases

Refresh
'Me.Painting = True
Me.Assocmfn.SetFocus
'DoCmd.Hourglass False
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Form_Dirty
' Author    : Norbert
' Date      : 5/12/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Form_Dirty(Cancel As Integer)
On Error GoTo Form_Dirty_Error
'MsgBox "dirty"
'If Me.Dirty Then
    Me.lblWarningChange.Visible = True
'Else
 '   Me.lblWarningChange.Visible = False

'End If

On Error GoTo 0
Exit Sub
Form_Dirty_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Dirty of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Form_Error
' Author    : Norbert
' Date      : 2/18/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Form_Error_Error
If DataErr = 7787 Then
         MsgBox "This record was edited by someone while you " _
               & "were making edits." & _
                 "Your edits cannot be saved. Please try again."
         Response = acDataErrContinue
         Me.Undo
     End If

On Error GoTo 0
Exit Sub
Form_Error_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Error of VBA Document Form_frmMaster"
 
End Sub
Private Sub Form_Load()
On Error GoTo PROC_ERR
Dim intComments As Integer


Me.lblWarningChange.Visible = False
Me.lblWarningMaster.Visible = False
Me.lblApplication.Visible = False
'20141119
Me.txtPriorMasterFileNo.Visible = False
'If Me.fSubDailyACHCcard.Form!ACHCcard = True Then

'for missing fields when save or exit 050713
'AS PER BRENDA 051013 DON'T NEED IT

'If Not IsNothing(Me.Lastremittancedate) Then
'    Me.lblFirstRemDate.Visible = False
'Else
'    Me.lblFirstRemDate.Visible = True
'End If
'-------------------------------------------------

'as per Brenda they need this comments 070513
'If IsNothing(Me.Comments) Then
'    Me.cmdTransfer.Visible = False
'    Me.Comments.Visible = False
'Else
'    Me.cmdTransfer.Visible = True
'    Me.Comments.Visible = True
'End If
'-----------------------------------------------------------------------
'20140402------------------as per Sue
If IsNothing(Me.Mastcreatedate) Then Me.Mastcreatedate = Date
'----------------------------------------------------------------------
Me.cmdSave.Visible = False
'Me.Painting = False
'DoCmd.Hourglass True
'Procedure to load the dif collection modes 10/3/11
CollectionModes
'Procedure to load the dif Product Codes 10/4/11 add Client Cancellation Information 043013
ProductCodeCases

'------------------------------------MASTER INACTIVE PROCESS --------------------------------021313
If IsLoaded("frmMasterClientSearch") Then
    If Forms!frmMasterClientSearch!txtProcess = "MASTINAC" Then
        Me.txtProcessMsg = "MASTER INACTIVE PROCESS"
        Me.txtProcessMsg.Visible = True
    '------------------------------------FSL IRS FORM W-9 REQ LETTER PROCESS --------------------------------022513
    ElseIf IsLoaded("frmMasterClientSearch") Then
        If Forms!frmMasterClientSearch!txtProcess = "W9REQLTR" Then
            Me.txtProcessMsg = "FSL IRS FORM W-9 REQ LETTER PROCESS"
            Me.txtProcessMsg.Visible = True
        End If
    Else
        Me.txtProcessMsg.Visible = False
    End If
End If
'9/13/11 comments count
intMasterComments = Nz(DCount("*", "tblMastComments", "MastSeqNo=" & Me.MasterfileNo))
Me.lblComments.Caption = "Tl Comments=" & intMasterComments
Me.Assocmfn.SetFocus
CommentsMaster (0)
Me.cmdGoto.Caption = "MASTER"
Me.AllowDeletions = False
Me.AllowEdits = False
Me.lblWarningMaster.Visible = False
Me.AllowAdditions = False
Me.Refresh
Me.Assocmfn.SetFocus

Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub


Private Sub InCareOf_AfterUpdate()
On Error GoTo PROC_ERR
    ''Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub


Private Sub Principals_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub Street_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Private Sub Street2_AfterUpdate()
On Error GoTo PROC_ERR
    'Me.ActiveControl = SetUpper(Me.ActiveControl)
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub
Private Sub cmdClose1_Click()
On Error GoTo cmdClose1_Click_Err
Dim lgNowMasterFileNo As Long
Dim lgNextMasterfile As Long
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
'add this procedure due to CWA Insurance missing as per Brenda  20140522

If NeedInfo Then Exit Sub
'-------------------------------------------------------------------------
If Me.lblWarningMaster.Caption <> "NEW" Then
    If Me.Dirty Then
    
        If vbNo = MsgBox("CHANGES WERE MADE!" & vbCrLf & vbCrLf & _
                      "ARE YOU SURE THAT YOU WANT TO EXIT WITHOUT SAVING?", vbCritical + vbYesNo, "ISM WARNING!") Then
       
            Exit Sub
        End If
   
        Me.Undo
        Me.Dirty = False
   
    End If
    Me.txtOpenArgHold = Me.OpenArgs
    If Not Me.Dirty Then DoCmd.Close acDefault, Me.Name, acSaveNo

'If MissingMasterInfo = True Then Exit Sub
End If
intPopulate = 0

'check if Agents are terminated
lgNowMasterFileNo = Me.MasterfileNo
lgNextMasterfile = NowMasterfileNo
'CHANGED 043013 due to conflict with cx masterfile
If Left(Me.txtProcessMsg, 7) = "CAUTION" Then
    If vbNo = MsgBox("THIS A NEW MASTER FILE NO =" & lgNowMasterFileNo & vbCrLf & _
           "PLEASE MAKE SURE THAT ALL THE INFORMATION IS CORRECT" & vbCrLf & _
           "DO YOU WANT TO SAVE THIS NEW MASTER FILE?", vbQuestion + vbYesNo, "CONFIRM NEW MASTER FILE!") Then
          
           If lgNowMasterFileNo <> lgNextMasterfile Then
                If vbOK = MsgBox("WARNING!...." & "OTHER USER OPEN A MASTERFILE " & lgNextMasterfile & vbCrLf & _
                                    "IF YOU SELECT 'OK' THIS MASTERFILE # " & lgNowMasterFileNo & " WILL NOT BE AVAILABLE ANYMORE", vbCritical + vbOKCancel, "DELETE MASTERFILENO " & lgNowMasterFileNo) Then
                    Me.AllowDeletions = True
                    DoCmd.RunCommand acCmdDeleteRecord
                    lgNowMasterFileNo = NowMasterfileNo
               

                    GoTo MASTERCLOSE
                Else
                End If
          Else
                Me.AllowDeletions = True
                DoCmd.RunCommand acCmdDeleteRecord
                lgNowMasterFileNo = NowMasterfileNo
                GoTo MASTERCLOSE
          End If
    End If
         Msg = "WARNING!....DID YOU SCAN THE APPLICATION FOR INSURANCE WITH THE INSURANCE # LABEL ASSIGNED?" & vbCrLf & _
                    "IF THIS MASTERFILE DOES NOT NEED AN INSURANCE APPLICATION PRESS CANCEL"
        Style = vbYesNoCancel + vbCritical + vbDefaultButton2
        Title = "SCAN APPLICATION"
        'Help = "DEMO.HLP"
        'Ctxt = 1000
        Response = MsgBox(Msg, Style, Title)
        
        If Response = vbYes Then
            Me.lblApplication.Visible = False
        ElseIf Response = vbNo Then
            Me.lblApplication = "PLEASE MAKE THE LABEL WITH THE POLICY # AND SCAN THE APPLICATION FOR INSURANCE"
            Me.lblApplication.Visible = True
            Me.cmdPDFFiles.SetFocus
            Exit Sub
         ElseIf Response = vbCancel Then
            Me.lblApplication.Visible = False
           
                    
        End If
        
        
       
End If

If Me.IsmaId = 0 Or IsNothing(Me.IsmaId) Then
    If vbYes = MsgBox("THIS A NEW MASTER FILE NO =" & lgNowMasterFileNo & vbCrLf & _
           "PLEASE MAKE SURE THAT ALL THE INFORMATION IS CORRECT" & vbCrLf & _
           "DO YOU WANT TO SAVE MASTERFILE# " & Me.MasterfileNo & "?" & vbCrLf & vbCrLf & "BY DELETING MASTERFILE #: " & lgNowMasterFileNo & " WILL NOT BE AVAILABLE..." _
           , vbQuestion + vbYesNo, "ISM") Then
    Else
           Me.AllowDeletions = True
           DoCmd.RunCommand acCmdDeleteRecord
           lgNowMasterFileNo = NowMasterfileNo
           GoTo MASTERCLOSE
    End If
End If

'410 HL02-ONL-NSF-CTL PROCESS TO PRINT LETTER THIS IS NOT THE WHOLE PROCEDURE ONLY PREPARATION
If Me.txtProcess = "HL02" Then
    If Me.CompanycodeLoanNo = "GTL-AM" Or Me.CompanycodeLoanNo = "CLIC" Or Me.CompanycodeLoanNo = "FSF" Or Me.CompanycodeLoanNo = "AIG" Then
            With Forms!frmHL02OnlNSFLtrSearch
                !txtMasterFileNo = Me.MasterfileNo
                !txtClientName = Me.ClientName
            End With
           
    Else
            MsgBox (" MastSeq# " & Me.MasterfileNo & " is not a Health/FCHS product." & vbCrLf & _
                      "Please try again. "), vbCritical, "ISM"
    End If
   
    If IsLoaded("frmMasterSummary") Then
         DoCmd.Close acForm, "frmMasterSummary"
    End If
    GoTo MASTERCLOSE
End If
'402 PA03 PROCESS TO PRINT LETTER THIS IS NOT THE WHOLE PROCEDURE ONLY PREPARATION
If Me.txtProcess = "PA03" Then
    If Me.IsmaProductCode = "FCHS" Or Me.IsmaProductCode = "HEALTH" Then
            With Forms!frmPA03OnlStopLtrSearch
                !txtMasterFileNo = Me.MasterfileNo
                !txtClientName = Me.ClientName
            End With
           
    Else
            MsgBox (" MastSeq# " & Me.MasterfileNo & " is not a Health/FCHS product." & vbCrLf & _
                      "Please try again. "), vbCritical, "ISM"
    End If
    If IsLoaded("frmMasterSummary") Then
         DoCmd.Close acForm, "frmMasterSummary"
    End If
    GoTo MASTERCLOSE
End If
'--------------------------------------------------------------------------------------------------------------
'403 PA04 PROCESS TO PRINT LETTER THIS IS NOT THE WHOLE PROCEDURE ONLY PREPARATION
If Me.txtProcess = "PA04" Then
    If Me.IsmaProductCode = "FCHS" Or Me.IsmaProductCode = "HEALTH" Then
            With Forms!frmPA04OnlClosedAcSearch
                !txtMasterFileNo = Me.MasterfileNo
                !txtClientName = Me.ClientName
            End With
           
    Else
            MsgBox (" MastSeq# " & Me.MasterfileNo & " is not a Health/FCHS product." & vbCrLf & _
                      "Please try again. "), vbCritical, "ISM"
    End If
    If IsLoaded("frmMasterSummary") Then
         DoCmd.Close acForm, "frmMasterSummary"
    End If
    GoTo MASTERCLOSE
End If
'--------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------
'496 CWA9 SEL-FSL-REL-RECS
If Me.txtProcess = "CWA9" Then
    If Me.CompanycodeLoanNo = "FSL" Then
            With Forms!frmSelFSLRelRecsSearch
                !txtMasterFileNo = Me.MasterfileNo
                !txtClientName = Me.ClientName
                !txtAssocMFN = Me.Assocmfn
                !txtCompanycodeLoanNo = Me.CompanycodeLoanNo
            End With
           
    Else
            MsgBox (" MastSeq# " & Me.MasterfileNo & " is not a FSL." & vbCrLf & _
                      "Please try again. "), vbCritical, "ISM"
    End If
    If IsLoaded("frmMasterSummary") Then
         DoCmd.Close acForm, "frmMasterSummary"
    End If
    GoTo MASTERCLOSE
End If
'--------------------------------------------------------------------------------------------------------------
'503 onl-fsl-new-bk-xtra
If Me.txtProcess = "BKXTRA" Then
    Select Case Forms!frmOnlFSLNewBkXtraSearch!txtProcedure
        Case 503
            If Me.CompanycodeLoanNo = "FSL" And Me.CollectionMode = "EFT" Then
                    With Forms!frmOnlFSLNewBkXtraSearch
                        !txtMasterFileNo = Me.MasterfileNo
                        !txtClientName = Me.ClientName
                        !txtAssocMFN = Me.Assocmfn
                        !txtCompanycodeLoanNo = Me.CompanycodeLoanNo
                    End With
                   
            Else
                    MsgBox UCase((" MastSeq# " & Me.MasterfileNo & " Comp.Code or Coll.Mode not valid." & vbCrLf & _
                              "Please try again. ")), vbCritical, "ISM"
           End If
        Case 508
            If Me.CompanycodeLoanNo = "FSL" Then
                    With Forms!frmOnlFSLNewBkXtraSearch
                        !txtMasterFileNo = Me.MasterfileNo
                        !txtClientName = Me.ClientName
                        !txtAssocMFN = Me.Assocmfn
                        !txtCompanycodeLoanNo = Me.CompanycodeLoanNo
                    End With
                   
            Else
                    MsgBox UCase((" MastSeq# " & Me.MasterfileNo & " Insurance Company not FSL" & vbCrLf & _
                              "Please try again. ")), vbCritical, "ISM"
           End If
       
       
        Case 1392
             If IsNothing(Me.W9Sent) Then
                    With Forms!frmOnlFSLNewBkXtraSearch
                        !txtMasterFileNo = Me.MasterfileNo
                        !txtClientName = Me.ClientName
                        !txtAssocMFN = Me.Assocmfn
                        !txtCompanycodeLoanNo = Me.CompanycodeLoanNo
                    End With
                   
            Else
                    MsgBox UCase((" MastSeq# " & Me.MasterfileNo & " W9 previously sent on " & Me.W9Sent & vbCrLf & _
                              "To re-send it again blank out W9 sent Date!")), vbCritical, "ISM"
           End If
   
   
    End Select
    If IsLoaded("frmMasterSummary") Then
         DoCmd.Close acForm, "frmMasterSummary"
    End If
    GoTo MASTERCLOSE
End If
'--------------------------------------------------------------------------------------------------------------

If IsLoaded("frmMasterClientSearch") Then
    If Forms!frmMasterClientSearch!txtProcess = "MASTINAC" Then GoTo MASTERCLOSE


    If Forms!frmMasterClientSearch!txtProcess = "W9REQLTR" Then
        If (Me.CompanycodeLoanNo = "FSL" Or Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC") And Me.Flexoption = "yes" Then
   
            If Not IsNothing(Me.W9Sent) Then
                MsgBox "W9 PREVIOUSLY SENT ON " & Me.W9Sent & vbCrLf & _
                "PROCESSING CANCELLED", vbCritical, "ISM"
                GoTo MASTERCLOSE
            Else
                'OnlW9DplxEngSpanLtr----------------------1392-----------------PROCESS LETTER 022513
                Dim rpt As Report
                Dim strRpt As String
                strQry = "qryrptOnlW9DplxEngSpanLtr"
                strRpt = "rptOnlW9DplxEngSpanLtr"
                strWhere = "MasterFileNo=" & Me.MasterfileNo
                lgEODRecords = Nz(DCount("*", strQry, strWhere))
                If lgEODRecords > 0 Then
                    strRpt = "rptOnlW9DplxEngSpanLtr"
                   
                    '090513 this is a prior way to print duplex
                    'PrinterDuplex (strRpt)
                    '---------------------------------------------
                  
                    'New way to print files if is duplex then bolDuplex=True 090513
                    'Prints individual MasterFileno reports to convert to PDF 11/19/11----ScanreportID=2
                    bolDuplex = True
                    Call PrtIndividualReport(strProc, strRpt, strQry, 274, "MasterFolder", 2, 3, 7, , , , , , , , "Default")
                    bolDuplex = False
                    '-------------------------------------------------------------------------------------
                   
                    'Update Masterfile W9Sent date-------------------------------022513
                    Me.AllowEdits = False
                    DoCmd.RunSQL "UPDATE tblMaster SET W9Sent =" & "#" & Grdate & "# WHERE MasterFileNo=" & Me.MasterfileNo
                End If
            End If
        Else
            MsgBox "Company needs to be FSL , APL or PNC ..." & vbCrLf & _
                   "PROCESSING CANCELLED", vbCritical, "ISM"
                   GoTo MASTERCLOSE
        End If
      
   
    End If
End If
If IsLoaded("frmMasterSummary") Then
        With Forms!frmMasterSummary
            '.cmdMaster.Caption = "NEW MFile#: " & lgNowMasterFileNo + 1
            'Call FrmRequery(Forms!frmMasterSummary, Me.MasterfileNo)
           
            'NEW MFile#:140619
            '.Requery
        End With
Else
        If IsLoaded("frmMasterClientSearch") Then
            With Forms!frmMasterClientSearch
                !lblMaster.Caption = "LAST MFile#:" & NowMasterfileNo
                '.Requery
            End With
        End If
End If




MASTERCLOSE:
 'pass the prior collection mode 20140211
 If IsLoaded("frmMasterClientSearch") Then
    With Forms!frmMasterClientSearch
        '20140303
        If Not IsNothing(!PriorCollMode) Then
        !PriorCollMode = Me.PriorCollMode
        !PresentCollectionMode = Me.CollectionMode
        If Not IsNothing(Me.PriorCollMode) And (Me.PriorCollMode <> Nz(DLookup("PriorCollectionMode", "tblInactiveMast", "MasterSeqno=" & Me.MasterfileNo))) Then
            DoCmd.RunSQL "UPDATE tblInactiveMast SET PriorCollectionMode='" & Me.PriorCollMode & "' WHERE MasterSeqno=" & Me.MasterfileNo
        End If
        End If
    End With
 End If
On Error Resume Next
DoCmd.Close acForm, Me.Name

cmdClose1_Click_Exit:
    Exit Sub

cmdClose1_Click_Err:
    MsgBox Error$
    Resume cmdClose1_Click_Exit

End Sub
Private Sub cmdClient_Click()
On Error GoTo cmdClient_Click_Err
'If IsLoaded("frmClient") Then
'    MsgBox "MASTERFILE IS OPEN BY CLIENT....", vbInformation, "ISM"
'    Exit Sub
'End If
 '   Forms!frmClient.SetFocus

'Else
   ' DoCmd.OpenForm "frmClient", acNormal, , "[IsmaId]=" & Me.IsmaId, , acDialog, Me.Name
   DoCmd.OpenForm "frmClient", acNormal, , "[IsmaId]=" & Me.IsmaId, , , Me.Name
'End If
Me.Visible = False
cmdClient_Click_Exit:
    Exit Sub

cmdClient_Click_Err:
    MsgBox Error$
    Resume cmdClient_Click_Exit

End Sub

Public Sub CommentsMaster(intC As Integer)
On Error GoTo PROC_ERR
'Onload is

If intC = 0 Then
    Me.BoxC.Visible = False
    Me.cmdADDC.Visible = False
    Me.cmdEditC.Visible = False
    Me.cmdDeleteC.Visible = False
    'Me.cmdOK.Visible = False
    Me.lblWarning.Visible = False
    Me.lblWarning.Caption = ""
    'Me.cmdAdd.Visible = True
    Me.cmdEdit.Visible = True
    Me.cmdDelete.Visible = True
    If Forms!frmMaster!fSubMasterComments.Form.AllowEdits = True Then
        Me.lblWarning.Visible = False
        Forms!frmMaster!fSubMasterComments.Form.AllowEdits = False
    'Me.cmdGoto.Enabled = True
    End If
Else
    Me.BoxC.Visible = True
    Me.cmdADDC.Visible = True
    Me.cmdEditC.Visible = True
    Me.cmdDeleteC.Visible = True
    'Me.cmdOK.Visible = True
    Me.lblWarning.Visible = True
    Me.lblWarning.Caption = ""
    'Me.cmdAdd.Visible = False
    Me.cmdEdit.Visible = False
    Me.cmdDelete.Visible = False
End If

PROC_EXIT:
    Exit Sub
   
PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo PROC_ERR
Dim rs As Object
Dim Frm As Form
Dim Frm1 As Form
Dim ctrl As Control


'If IsLoaded("frmMasterSummary") Then
'    Set frm = Forms!frmMasterSummary
'    Set ctrl = frm.MasterFileNo
'ElseIf IsLoaded("frmMasterClientSearch") Then
'
'    Set frm = Forms!frmMasterClientSearch
'    Set ctrl = frm.MasterFileNo
'    If IsNothing(frm.MasterFileNo) Then GoTo EndSub
'End If
'
'If Not IsNothing(ctrl) Then
'   Set RS = Me.Recordset.Clone
'   RS.FindFirst "MasterFileNo =" & ctrl
'
'   If Not RS.EOF Then Me.Bookmark = RS.Bookmark
'Else
'   Set RS = Me.Recordset.Clone
'   RS.FindFirst "MasterFileNo =" & ctrl
'   Me.Bookmark = RS.Bookmark
'End If
EndSub:
Set rs = Nothing
Me.AllowDeletions = False
Me.AllowEdits = False
Me.lblWarningMaster.Visible = False

Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next

End Sub
Public Sub CollectionModes_temp()
On Error GoTo PROC_ERR
Me.lblEFT.Visible = False
Me.cmdCCard.Visible = False
Me.boxEFT.Visible = False
Me.PreNoteDate.Visible = False
Me.Nextcollectiondate.Visible = False
Me.LastCollDate.Visible = False
Me.EFTCustodialFee.Visible = False
Me.Eftgrosscollamt.Visible = False
Me.EFTCollCycle.Visible = False
Me.CheckSave.Visible = False
Me.TransitRouteNo.Visible = False
Me.TRNo.Visible = False
Me.AccountNo.Visible = False
Me.Eftcomments.Visible = True

Me.lblPRD.Visible = False
Me.boxPRD.Visible = False
Me.IsmaId3.Visible = False
Me.cmdEmp.Visible = False
Me.IsmaId31.Visible = False
Me.cmdEmp.Visible = False
Me.Prdcustodialfee.Visible = False
Me.Prdgrosscollamt.Visible = False
Me.DeductionCycle.Visible = False
Me.Prdbillingcycle.Visible = False
Me.Calcbillamt.Visible = False
Me.Nextbilldate.Visible = False
Me.LastBill.Visible = False

Me.lblDirectBill.Visible = False
Me.boxDirectBill.Visible = False
'Me.DBCustodialFee.Visible = False
Me.DBGrossBillAmt.Visible = False
Me.Dbremitamt.Visible = False
Me.Dbreceiveddate.Visible = False
Me.Dbremitteddate.Visible = False
Me.DBNextBillDate.Visible = False
Me.Dblastbilldate.Visible = False

Me.CCardNo.Visible = False
Me.CCardExpDate.Visible = False
Me.ExpLtrSentDate.Visible = False


Me.lblRemittance.Visible = True
Me.boxRemittance.Visible = True
'Me.RemittancePmtAmt.Visible = True
Me.RemPmtCycle.Visible = True
Me.PaymentStatus.Visible = True
Me.NextRemittanceDate.Visible = True
Me.LastRemDate.Visible = True

Me.lblWDC.Visible = False
Me.boxWDC.Visible = False
'Me.Lapsedate.Visible = False
Me.Wdcpmtamt.Visible = False
Me.Wdccycle.Visible = False

Me.Eftasofdate.Visible = False

'way to disable a control 10/3/11
Me.RemittancePmtAmt.Enabled = False
Me.RemittancePmtAmt.Locked = True
Me.RemittancePmtAmt.BackStyle = 0
Select Case Me.CollectionMode
    Case "Fed Allot"
        Me.PreNoteDate.Visible = False
        Me.Nextcollectiondate.Visible = False
        Me.LastCollDate.Visible = False
        Me.CheckSave.Visible = False
        Me.TransitRouteNo.Visible = False
        Me.TRNo.Visible = False
        Me.AccountNo.Visible = False
        Me.EFTCustodialFee.Visible = True
        Me.Eftgrosscollamt.Visible = True
        Me.EFTCollCycle.Visible = True
        Me.lblEFT.Visible = True
        Me.lblEFT.Caption = "Fed Allot"
        Me.boxEFT.Visible = True
   
    Case "EFT", "CCard"
        'changed to visible as per Sue 072213
        Me.PreNoteDate.Visible = True
        Me.lblEFT.Visible = True
        Me.boxEFT.Visible = True
        Me.Nextcollectiondate.Visible = True
        Me.LastCollDate.Visible = True
        Me.EFTCustodialFee.Visible = True
        Me.Eftgrosscollamt.Visible = True
        Me.EFTCollCycle.Visible = True
        Me.CheckSave.Visible = True
        Me.TransitRouteNo.Visible = True
        Me.TRNo.Visible = True
        Me.AccountNo.Visible = True
        Me.Eftcomments.Visible = True
        If Not IsNothing(Me.Eftasofdate) Then Me.Eftasofdate.Visible = True
        If Me.CollectionMode = "CCard" Then
            Me.lblEFT.Caption = "CREDIT CARD"
            Me.PreNoteDate.Visible = False
            'Me.lblNoteDate.Caption = "Card Exp Date"
            Me.lblNextDate.Caption = "Next Coll Date"
            Me.lblLastDate.Caption = "Last Coll Date"
            Me.CCardNo.Visible = True
            Me.CCardExpDate.Visible = True
            Me.ExpLtrSentDate.Visible = True
            Me.AccountNo.Visible = False
            Me.TRNo.Visible = False
            Me.TransitRouteNo.Visible = False
            Me.CheckSave.Visible = False
           
        Else
            Me.lblEFT.Caption = "EFT"
            'changed to visible as per Sue 072213
            Me.PreNoteDate.Visible = True
            Me.lblNoteDate.Caption = "Pre Note Date"
            Me.lblNextDate.Caption = "Next EFT Date"
            Me.lblLastDate.Caption = "Last EFT Date"
            Me.CCardNo.Visible = False
            Me.CCardExpDate.Visible = False
            Me.ExpLtrSentDate.Visible = False
            Me.AccountNo.Visible = True
            Me.TRNo.Visible = True
            Me.TransitRouteNo.Visible = True
            Me.CheckSave.Visible = True
           
        End If
  
    Case "PRD"
        Me.lblPRD.Visible = True
        Me.boxPRD.Visible = True
        Me.IsmaId3.Visible = True
        Me.cmdEmp.Visible = True
        Me.IsmaId31.Visible = True
        Me.Prdcustodialfee.Visible = True
        Me.Prdgrosscollamt.Visible = True
        Me.DeductionCycle.Visible = True
        Me.Prdbillingcycle.Visible = True
        Me.Calcbillamt.Visible = True
        Me.Nextbilldate.Visible = True
        Me.LastBill.Visible = True
        'PRD/FA don't enter 1st Remit date 8/31/11
        'Me.Nextremittancedate.Visible = False
        Me.RemittancePmtAmt.Enabled = False
        Me.RemittancePmtAmt.Locked = True
        Me.RemittancePmtAmt.BackStyle = 0
    Case "Direct Bill"
        Me.lblDirectBill.Visible = True
        Me.boxDirectBill.Visible = True
        Me.DBCustodialFee.Visible = True
        Me.DBGrossBillAmt.Visible = True
        Me.Dbremitamt.Visible = False
        Me.Dbreceiveddate.Visible = True
        Me.Dbremitteddate.Visible = True
        Me.DBNextBillDate.Visible = True
        Me.Dblastbilldate.Visible = True
        Me.Dbremitamt.Visible = False
        'Me.RemittancePmtAmt.Visible = False
    Case "10YR Prepay"
        Me.lblRemittance.Visible = False
        Me.boxRemittance.Visible = False
        'Me.RemittancePmtAmt.Visible = False
        Me.RemPmtCycle.Visible = False
        Me.PaymentStatus.Visible = False
        Me.NextRemittanceDate.Visible = False
        Me.LastRemDate.Visible = False
     Case "WDC", "NBC", "LUMP", "TBC"
        Me.lblWDC.Visible = True
        Me.boxWDC.Visible = True
        'Me.Lapsedate.Visible = True
        Me.Wdcpmtamt.Visible = True
        Me.Wdccycle.Visible = True
        'Me.Wdccycle = "WDC"

        Me.lblRemittance.Visible = True
        Me.boxRemittance.Visible = True
        'Me.RemittancePmtAmt.Visible = False
        Me.RemPmtCycle.Visible = True
        Me.PaymentStatus.Visible = False
        Me.NextRemittanceDate.Visible = False
        Me.LastRemDate.Visible = False
        'Me.Rempmtcycle = "WDC"
End Select
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub
Public Sub CollectionModes()
On Error GoTo PROC_ERR
Dim intTabIndex As Integer

intTabIndex = Me.Lapsedate.TabIndex
Me.txTab = intTabIndex

Me.IsmaIdAssWeb.Visible = False
Me.lblAccnt.Visible = False


Me.lblEFT.Visible = False
Me.cmdCCard.Visible = False
Me.boxEFT.Visible = False
Me.PreNoteDate.Visible = False
Me.Nextcollectiondate.Visible = False
Me.LastCollDate.Visible = False
Me.EFTCustodialFee.Visible = False
Me.Eftgrosscollamt.Visible = False
Me.EFTCollCycle.Visible = False
Me.CheckSave.Visible = False
Me.TransitRouteNo.Visible = False
Me.TRNo.Visible = False
Me.AccountNo.Visible = False
Me.Eftcomments.Visible = True

Me.lblPRD.Visible = False
Me.boxPRD.Visible = False
Me.IsmaId3.Visible = False
Me.cmdEmp.Visible = False
Me.IsmaId31.Visible = False
Me.Prdcustodialfee.Visible = False
Me.Prdgrosscollamt.Visible = False
Me.DeductionCycle.Visible = False
Me.Prdbillingcycle.Visible = False
Me.Calcbillamt.Visible = False
Me.Nextbilldate.Visible = False
Me.LastBill.Visible = False

Me.lblDirectBill.Visible = False
Me.boxDirectBill.Visible = False
Me.DBCustodialFee.Visible = False
Me.DBGrossBillAmt.Visible = False
Me.Dbremitamt.Visible = False
Me.Dbreceiveddate.Visible = False
Me.Dbremitteddate.Visible = False
Me.DBNextBillDate.Visible = False
Me.Dblastbilldate.Visible = False

Me.CCardNo.Visible = False
Me.CCardExpDate.Visible = False
Me.ExpLtrSentDate.Visible = False

Me.lblRemittance.Visible = True
Me.boxRemittance.Visible = True
'Me.RemittancePmtAmt.Visible = True
Me.RemPmtCycle.Visible = True
Me.PaymentStatus.Visible = True
Me.NextRemittanceDate.Visible = True
Me.LastRemDate.Visible = True

Me.lblWDC.Visible = False
Me.boxWDC.Visible = False
'Me.Lapsedate.Visible = False
Me.Wdcpmtamt.Visible = False
Me.Wdccycle.Visible = False

'way to disable a control 10/3/11
Me.RemittancePmtAmt.Enabled = False
Me.RemittancePmtAmt.Locked = True
Me.RemittancePmtAmt.BackStyle = 0
If Not IsNothing(Me.CollectionMode) Then
Select Case Me.CollectionMode
    Case "Fed Allot"
        Me.PreNoteDate.Visible = False
        Me.Nextcollectiondate.Visible = False
        Me.LastCollDate.Visible = False
        Me.CheckSave.Visible = False
        Me.TransitRouteNo.Visible = False
        Me.TRNo.Visible = False
        Me.AccountNo.Visible = False
       
        Me.EFTCustodialFee.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCustodialFee.TabIndex = intTabIndex
       
        Me.Eftgrosscollamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Eftgrosscollamt.TabIndex = intTabIndex
       
        Me.EFTCollCycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCollCycle.TabIndex = intTabIndex
       
        'got to the next-----------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
          
        '------------------------------------------------------------------------
       
       
       
        Me.lblEFT.Visible = True
        Me.lblEFT.Caption = "Fed Allot"
        Me.boxEFT.Visible = True
   
    Case "CCard"
        Me.lblEFT.Caption = "CREDIT CARD"
        Me.cmdCCard.Visible = True
        Me.PreNoteDate.Visible = False
        Me.lblNextDate.Caption = "Next Coll Date"
        Me.lblLastDate.Caption = "Last Coll Date"
        Me.CCardNo.Visible = True
        Me.AccountNo.Visible = False
        Me.TRNo.Visible = False
        Me.TransitRouteNo.Visible = False
        Me.CheckSave.Visible = False
       
        Me.lblEFT.Visible = True
        Me.boxEFT.Visible = True
        '1
        Me.Nextcollectiondate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Nextcollectiondate.TabIndex = intTabIndex
        '2
        Me.LastCollDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.LastCollDate.TabIndex = intTabIndex
        '3
        Me.EFTCustodialFee.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCustodialFee.TabIndex = intTabIndex
        '4
        Me.Eftgrosscollamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Eftgrosscollamt.TabIndex = intTabIndex
        '5
        Me.EFTCollCycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCollCycle.TabIndex = intTabIndex
        '6
        Me.ExpLtrSentDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.ExpLtrSentDate.TabIndex = intTabIndex
        '7
        Me.ExpLtrSentDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.ExpLtrSentDate.TabIndex = intTabIndex
        '8
        Me.CCardExpDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.CCardExpDate.TabIndex = intTabIndex
        '9
        Me.CCardNo.Visible = True
        intTabIndex = intTabIndex + 1
        Me.CCardNo.TabIndex = intTabIndex
        '10
        Me.Eftcomments.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Eftcomments.TabIndex = intTabIndex
        If Not IsNothing(Me.Eftasofdate) Then Me.Eftasofdate.Visible = True
        'got to the next
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
    
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
       
        'intTabIndex = intTabIndex + 1
        'Me.PaymentStatus.TabIndex = intTabIndex
       
        'intTabIndex = intTabIndex + 1
        'Me.PaymentStatus.TabIndex = intTabIndex
       
     Case "EFT"
        Me.lblEFT.Caption = "EFT"
        Me.lblEFT.Visible = True
        Me.boxDirectBill.Visible = True
        Me.lblNoteDate.Caption = "Pre Note Date"
        Me.lblNextDate.Caption = "Next EFT Date"
        Me.lblLastDate.Caption = "Last EFT Date"
        Me.CCardNo.Visible = False
        Me.CCardExpDate.Visible = False
        Me.ExpLtrSentDate.Visible = False
        'changed to visible as per Sue 072213
         Me.PreNoteDate.Visible = True
        '1
        Me.Nextcollectiondate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Nextcollectiondate.TabIndex = intTabIndex
       
        '2
        Me.LastCollDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.LastCollDate.TabIndex = intTabIndex
              
        '2
        Me.EFTCustodialFee.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCustodialFee.TabIndex = intTabIndex
       
        '3
        Me.Eftgrosscollamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Eftgrosscollamt.TabIndex = intTabIndex
               
        '4
        Me.EFTCollCycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.EFTCollCycle.TabIndex = intTabIndex
               
        '5
        Me.CheckSave.Visible = True
        intTabIndex = intTabIndex + 1
        Me.CheckSave.TabIndex = intTabIndex
       
        '6
        Me.TransitRouteNo.Visible = True
        intTabIndex = intTabIndex + 1
        Me.TransitRouteNo.TabIndex = intTabIndex
       
        '7
        Me.TRNo.Visible = True
        intTabIndex = intTabIndex + 1
        Me.TRNo.TabIndex = intTabIndex
       
        '8
        Me.AccountNo.Visible = True
        intTabIndex = intTabIndex + 1
        Me.AccountNo.TabIndex = intTabIndex
       
        '9
        Me.Eftcomments.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Eftcomments.TabIndex = intTabIndex
        If Not IsNothing(Me.Eftasofdate) Then Me.Eftasofdate.Visible = True
       
        'got to the next-----------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
       
        '20140402----------as per Sue-------------------------------------------
        If IsNothing(Me.PreNoteDate) Then Me.PreNoteDate = Date
        '------------------------------------------------------------------------
'
'
'        If Me.CollectionMode = "CCard" Then
'            Me.lblEFT.Caption = "CREDIT CARD"
'            Me.PreNoteDate.Visible = False
'            Me.lblNextDate.Caption = "Next Coll Date"
'            Me.lblLastDate.Caption = "Last Coll Date"
'            Me.CCardNo.Visible = True
'
'            Me.CCardExpDate.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.CCardExpDate.TabIndex = intTabIndex
'
'            Me.ExpLtrSentDate.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.ExpLtrSentDate.TabIndex = intTabIndex
'
'            Me.AccountNo.Visible = False
'            Me.TRNo.Visible = False
'            Me.TransitRouteNo.Visible = False
'            Me.CheckSave.Visible = False
'
'        Else
           
           
'            Me.AccountNo.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.AccountNo.TabIndex = intTabIndex
'
'            Me.TRNo.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.TRNo.TabIndex = intTabIndex
'
'            Me.TransitRouteNo.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.TransitRouteNo.TabIndex = intTabIndex
'
'            Me.CheckSave.Visible = True
'            intTabIndex = intTabIndex + 1
'            Me.CheckSave.TabIndex = intTabIndex
        'End If
       
    Case "PRD"
        Me.lblPRD.Visible = True
        Me.boxPRD.Visible = True
       
        Me.IsmaId3.Visible = True
        Me.cmdEmp.Visible = True
        intTabIndex = intTabIndex + 1
        Me.IsmaId3.TabIndex = intTabIndex
       
        Me.IsmaId31.Visible = True
        intTabIndex = intTabIndex + 1
        Me.IsmaId31.TabIndex = intTabIndex
       
        Me.Prdcustodialfee.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Prdcustodialfee.TabIndex = intTabIndex
               
        Me.Prdgrosscollamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Prdgrosscollamt.TabIndex = intTabIndex
       
        Me.Nextbilldate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Nextbilldate.TabIndex = intTabIndex
              
       
        Me.DeductionCycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.DeductionCycle.TabIndex = intTabIndex
       
        Me.Prdbillingcycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Prdbillingcycle.TabIndex = intTabIndex
       
        Me.Calcbillamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Calcbillamt.TabIndex = intTabIndex
              
        Me.LastBill.Visible = True
        intTabIndex = intTabIndex + 1
        Me.LastBill.TabIndex = intTabIndex
            
        'got to the next-----------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
          
        '------------------------------------------------------------------------
            
            
            
       
        'PRD/FA don't enter 1st Remit date 8/31/11
        'Me.Nextremittancedate.Visible = False
        Me.DBCustodialFee.Visible = False
        Me.RemittancePmtAmt.Enabled = False
        Me.RemittancePmtAmt.Locked = True
        Me.RemittancePmtAmt.BackStyle = 0
    Case "Direct Bill"
        Me.lblDirectBill.Visible = True
       
        Me.boxDirectBill.Visible = True
               
        Me.DBCustodialFee.Visible = True
        intTabIndex = intTabIndex + 1
        Me.DBCustodialFee.TabIndex = intTabIndex
       
        Me.DBGrossBillAmt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.DBGrossBillAmt.TabIndex = intTabIndex
       
        Me.Dbremitamt.Visible = False
        intTabIndex = intTabIndex + 1
        'Me.Dbremitamt.TabIndex = intTabIndex
       
        Me.Dbreceiveddate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Dbreceiveddate.TabIndex = intTabIndex
       
        Me.DBNextBillDate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.DBNextBillDate.TabIndex = intTabIndex
       
        Me.Dblastbilldate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Dblastbilldate.TabIndex = intTabIndex
       
        Me.Dbremitteddate.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Dbremitteddate.TabIndex = intTabIndex
              
        'got to the next-----------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
          
        '------------------------------------------------------------------------
        'changed to true 20140502
        Me.Dbremitamt.Visible = False
              
       
        'Me.RemittancePmtAmt.Visible = False
    Case "10YR Prepay"
        Me.lblRemittance.Visible = False
        Me.boxRemittance.Visible = False
        'Me.RemittancePmtAmt.Visible = False
        Me.DBCustodialFee.Visible = False
        Me.RemPmtCycle.Visible = False
        Me.PaymentStatus.Visible = False
        Me.NextRemittanceDate.Visible = False
        Me.LastRemDate.Visible = False
       
        intTabIndex = Me.Comments.TabIndex
           
       
     Case "WDC", "NBC", "LUMP", "TBC"
        Me.lblWDC.Visible = True
        Me.boxWDC.Visible = True
       
        'Me.Lapsedate.Visible = True
        intTabIndex = intTabIndex + 1
        'Me.Lapsedate.TabIndex = intTabIndex
       
        Me.Wdcpmtamt.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Wdcpmtamt.TabIndex = intTabIndex
       
        Me.Wdccycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.Wdccycle.TabIndex = intTabIndex
               
        Me.RemPmtCycle.Visible = True
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
       
        'got to the next-----------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.PaymentStatus.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.NextRemittanceDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.LastRemDate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.RemPmtCycle.TabIndex = intTabIndex
          
        '------------------------------------------------------------------------
       
        'Me.Wdccycle = "WDC"
        Me.DBCustodialFee.Visible = False
        Me.lblRemittance.Visible = True
       
        'Me.RemittancePmtAmt.Visible = False
      
       
        Me.boxRemittance.Visible = True
        Me.PaymentStatus.Visible = False
        Me.NextRemittanceDate.Visible = False
        Me.LastRemDate.Visible = False
        'Me.Rempmtcycle = "WDC"
End Select
End If
'--------------------------------------------------------
        intTabIndex = intTabIndex + 1
        Me.AgentID.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.AgentName.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.PrcBusagent1.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.Writingstate.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.AgentID2.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.AgentName2.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.PrcBusagent2.TabIndex = intTabIndex
       
        intTabIndex = intTabIndex + 1
        Me.Controlledbus.TabIndex = intTabIndex
        '---------------------------------------------------------



Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub

Public Sub ProductCodeCases()
On Error GoTo PROC_ERR
'-----------------------------------------------------Membership # as per Brenda 10/3/11-------------------------------------
If Not IsNothing(Me.IsmaProductCode) Then
Select Case Me.IsmaProductCode
    Case "Association"
        Me.lblAccnt.Visible = True
        Me.lblAccnt.Caption = "Member#"
    Case "Mutual Fund", "Website", "Credit Union"
        Me.lblAccnt.Visible = True
        Me.lblAccnt.Caption = "Accnt#"
    Case Else
        Me.lblAccnt.Visible = False
End Select

Select Case Me.IsmaProductCode
    Case "Association", "Website"
        Me.MembershipNo.Visible = False
        Me.IsmaIdAssWeb.Visible = True
    Case "Mutual Fund", "Credit Union"
        Me.MembershipNo.Visible = True
        Me.IsmaIdAssWeb.Visible = False
    Case Else
        Me.MembershipNo.Visible = False
        Me.IsmaIdAssWeb.Visible = False
End Select
End If
'043013 missing from original Brendas Master design

If Not IsNothing(Me.Potentialrefund) Then
If Me.Potentialrefund = "YES" Then
    Me.Prevremit.Enabled = True
    Me.AmountToRefund.Enabled = True
   
    Me.Custfeerefamt.Enabled = True
    Me.Refundcomments.Enabled = True
Else
    Me.Prevremit.Enabled = False
    Me.AmountToRefund.Enabled = False
    Me.Custfeerefamt.Enabled = False
    Me.Refundcomments.Enabled = False
End If
End If
Exit Sub
   
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next

'-----------------------------------------------------------------------------------------------------------------------------
End Sub

'---------------------------------------------------------------------------------------
' Procedure : IsmaID_AfterUpdate
' Author    : Norbert
' Date      : 5/8/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub IsmaId_AfterUpdate()
On Error GoTo IsmaId_AfterUpdate_Error
Me.ClientName = Me.IsmaId
Me.ClientName.Requery

On Error GoTo 0
Exit Sub
IsmaId_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure IsmaID_AfterUpdate of VBA Document Form_frmMaster"
End Sub


'---------------------------------------------------------------------------------------
' Procedure : IsmaId2_AfterUpdate
' Author    : Norbert
' Date      : 5/12/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub IsmaID2_AfterUpdate()
Dim strName As String
On Error GoTo IsmaID2_AfterUpdate_Error
If Not IsNothing(Me.ActiveControl) Then
    strName = Nz(DLookup("jtxtLastFirst", "tblPayor", "IsmaID=" & Nz(Me.ActiveControl, 0)))
Else
    Exit Sub
End If
If Not IsNothing(strName) Then
    If vbYes = MsgBox("SSN: " & Format(Me.ActiveControl, "000-00-0000") & "  IS ASSIGNED TO " & UCase(strName) & vbCrLf & vbCrLf & _
            "DO YOU WANT TO SELECT THIS SSN?", vbCritical + vbYesNo, "ISM") Then
        Exit Sub
   
    Else
           
    Me.IsmaId2 = ""
    Me.IsmaId2.SetFocus
    Exit Sub
    End If
Else
    DoCmd.OpenForm "frmPayor", , , , acFormAdd, acDialog, Me.Name
End If

'If Nz(DCount("ISMAID", "tblPayor", "ISMAID=" & Nz(Me.ActiveControl, 0))) = 0 Then
'  'Cancel = True
'     If MsgBox("THIS SSN BELONGS TO: " & vbCrLf & Nz(DLookup("jTxtLastFirst", "tblPayor", "ISMAID=" & Nz(Me.ActiveControl, 0))) & vbCrLf & _
'        "CONFIRM IF CORRECT", vbQuestion + vbYesNo, "ISM") = vbYes Then
'        Else
'        'Me.PayorName.SetFocus
'
'        'DoCmd.OpenForm "frmPayorSSN", acNormal, , "ISMAID=" & Me.ActiveControl
'        Me.ActiveControl = ""
'        Me.ActiveControl.SetFocus
'
'     End If
'Else
 '   DoCmd.OpenForm "frmPayor", , , , acFormAdd, acDialog, Me.Name
   
'End If
On Error GoTo 0
Exit Sub
IsmaID2_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure IsmaId2_AfterUpdate of VBA Document Form_frmMaster"
End Sub


Private Sub IsmaID3_AfterUpdate()
Me.IsmaId31.SetFocus
End Sub

Private Sub IsmaProductCode_AfterUpdate()
On Error GoTo PROC_ERR
'Procedure to load the dif Product Codes 10/4/11
ProductCodeCases
Exit Sub
PROC_ERR:
    MsgBox "The following error occured: " & Error$
    Resume Next
End Sub


'---------------------------------------------------------------------------------------
' Procedure : POPULATEFRMMASTERCLIENTSEARCH
' Author    : Norbert
' Date      : 2/13/2013
' Purpose   : W-TPA------86-----SEL-MAST-FOR-INACTIVE
'---------------------------------------------------------------------------------------
Public Sub POPULATEFRMMASTERCLIENTSEARCH()
On Error GoTo POPULATEFRMMASTERCLIENTSEARCH_Error
Dim pot_refund As String

Select Case (Me.CollectionMode)
        Case "EFT", "CCard", "NBC"
             '20140717 change lastremdate from lastremittancedate ?????
             If Me.LastCollDate > Me.LastRemDate And Me.LastCollDate <> Me.PreNoteDate Then
               pot_refund = "y"
             End If
        Case "Direct Bill"
             If Not IsNothing(Me.Dbreceiveddate) And IsNothing(Me.Dbremitteddate) Then
                 pot_refund = "y"
             End If
        Case "Fed Allot"
             If Nz(DCount("*", "QS_FaHistoryInactiveMast", "MasterSeqNo=" & Me.MasterfileNo)) Then
                 pot_refund = "y"
             End If
        Case "PRD", "TBC"
             If Nz(DCount("*", "QS_PrdBillingHistoryInactiveMast", "MasterSeqNo=" & Me.MasterfileNo)) Then
                 pot_refund = "y"
             End If
End Select


With Forms!frmMasterClientSearch
                !MasterseqNo = Me.MasterfileNo
                !CompCode = Me.CompanycodeLoanNo
                !NewStatus = Me.Productstatus
                !CancelCode = Me.Ccode
               
                !Comments = Me.Comments
                !AssCancel = Me.Revinit
                !ClientSsn = Me.IsmaId
               
                !CollectMode = IIf(Me.CollectionMode = "NBC", "NBC", IIf(Me.CollectionMode = "BAC", "BAC", ""))
                !DollarAmt = IIf(Me.CollectionMode = "Direct Bill", Nz(Me.DBGrossBillAmt, 0) - Nz(Me.DBCustodialFee, 0), _
                             IIf(Me.CollectionMode = "WDC", Nz(Me.Wdcpmtamt, 0), Nz(Me.RemittancePmtAmt, 0)))
                !PotRef = IIf(pot_refund = "y", "yes", "")
               
                '!Policycancelreason = Me.Policycancelreason
                             
                !txtClientName = Me.ClientName
                .SetFocus
End With

On Error GoTo 0
Exit Sub
POPULATEFRMMASTERCLIENTSEARCH_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure POPULATEFRMMASTERCLIENTSEARCH of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : IsmaProductCode_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub IsmaProductCode_Change()
On Error GoTo IsmaProductCode_Change_Error
Me.CollectionMode.SetFocus

On Error GoTo 0
Exit Sub
IsmaProductCode_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure IsmaProductCode_Change of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Lastremittancedate_AfterUpdate
' Author    : Norbert
' Date      : 5/8/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Lastremittancedate_AfterUpdate()
On Error GoTo Lastremittancedate_AfterUpdate_Error
'not need it as per Sue 080513
'If Not IsNothing(Me.Lastremittancedate) Then
'    Me.lblFirstRemDate.Visible = False
'Else
'    Me.lblFirstRemDate.Visible = True
'End If

On Error GoTo 0
Exit Sub
Lastremittancedate_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Lastremittancedate_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Nextcollectiondate_AfterUpdate
' Author    : Norbert
' Date      : 7/22/2013
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Nextcollectiondate_AfterUpdate()
Dim intDay As Integer
Dim intMonth As Integer

   On Error GoTo Nextcollectiondate_AfterUpdate_Error

intDay = Day(Me.Nextcollectiondate)
intMonth = Month(Me.Nextcollectiondate)

If intDay = 2 Or intDay = 7 Or intDay = 12 Or intDay = 17 Then
    Me.Nextcollectiondate.SetFocus
    Exit Sub
End If

If intDay = 27 And intMonth = Month(Date) - 1 Then
    Me.Nextcollectiondate.SetFocus
    Exit Sub
End If

MsgBox "PLEASE VERIFY DRAFT DATE FOR 'EFT'!" & vbCrLf & _
       "NEW DRAFT DATES: 27th of prior month" & vbCrLf & _
       "2nd or 7th or 12th or 17th", vbCritical, "ISM"
Me.Nextcollectiondate.SetFocus

   On Error GoTo 0
   Exit Sub

Nextcollectiondate_AfterUpdate_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Nextcollectiondate_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : Nextcollectiondate_Exit
' Author    : Norbert
' Date      : 7/22/2013
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Nextcollectiondate_Exit(Cancel As Integer)
Dim intDay As Integer
Dim intMonth As Integer
On Error GoTo Nextcollectiondate_Exit_Error
If IsNothing(Me.ActiveControl) Then Exit Sub
intDay = Day(Me.Nextcollectiondate)
intMonth = Month(Me.Nextcollectiondate)

If intDay = 2 Or intDay = 7 Or intDay = 12 Or intDay = 17 Or intDay = 27 Then
    '092713 take out as per Brenda
    'And (intMonth = Month(Me.NextRemittanceDate) - 1
    Exit Sub
End If

'If intDay = 27 And intMonth = Month(Me.Nextcollectiondate) - 1 Then
'
'    Exit Sub
'End If

MsgBox "PLEASE VERIFY DRAFT DATES!" & vbCrLf & _
       "27th-2nd-7th-12th-17th", vbCritical, "ISM"
Me.Nextcollectiondate.SetFocus

   On Error GoTo 0
   Exit Sub

Nextcollectiondate_Exit_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Nextcollectiondate_Exit of VBA Document Form_frmMaster"
End Sub


'---------------------------------------------------------------------------------------
' Procedure : Nextremittancedate_Exit
' Author    : Norbert
' Date      : 7/22/2013
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Nextremittancedate_Exit(Cancel As Integer)
On Error GoTo Nextremittancedate_Exit_Error

If IsNothing(Me.ActiveControl) Then Exit Sub
'20140821
If Me.CollectionMode = "Fed Allot" Then Exit Sub

If Me.CompanycodeLoanNo = "APL" Or Me.CompanycodeLoanNo = "PNC" Then
    If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
        If Day(Me.NextRemittanceDate) <> 25 Then
            MsgBox "PLEASE VERIFY REMIT DATE-DAY SHOULD BE THE 25th", vbCritical, "ISM"
            Me.NextRemittanceDate.SetFocus
        End If
    End If
ElseIf Me.CompanycodeLoanNo = "PHL" Or Me.CompanycodeLoanNo = "SMA" Then
        If Day(Me.NextRemittanceDate) <> 6 Then
            If Me.RemPmtCycle <> "Annual" Then
                MsgBox "PLEASE VERIFY REMIT DATE-DAY SHOULD BE THE 6th", vbCritical, "ISM"
                Me.NextRemittanceDate.SetFocus
            End If
        End If
End If

On Error GoTo 0
Exit Sub

Nextremittancedate_Exit_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Nextremittancedate_Exit of VBA Document Form_frmMaster"
End Sub


Private Sub PayorName_AfterUpdate()
On Error GoTo PayorName_AfterUpdate_Error
Me.Cwaamtrec.SetFocus

On Error GoTo 0
Exit Sub
PayorName_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PayorName_AfterUpdate of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : PayorName_MouseDown
' Author    : Norbert
' Date      : 5/11/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub PayorName_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo PayorName_MouseDown_Error
If X >= 3735 And X <= 3945 Then
   
    Me.Cwaamtrec.SetFocus
    'You can use the line below to determine the coordinates.  Remove the comment, go to Access and switch the form to form view.
    'carefully click around the left and right edges of the drop-down square to determine its left and right extremes
   
End If
'MsgBox X

On Error GoTo 0
Exit Sub
PayorName_MouseDown_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PayorName_MouseDown of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : PayorName_NotInList
' Author    : Norbert
' Date      : 5/7/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub PayorName_NotInList(pstrNewData As String, pintResponse As Integer)
Dim strPayor As String
Dim intReturn As Integer
   
On Error GoTo PayorName_NotInList_Error
strPayor = StrConv(pstrNewData, vbProperCase)
intReturn = MsgBox("PAYOR " & strPayor & _
        " IS NOT IN ISM DATABASE.  DO YOU WANT TO ADD THIS PAYOR?", _
        vbQuestion + vbYesNo, "ISM")
    If intReturn = vbYes Then
        DoCmd.OpenForm "frmPayor", acNormal, , , acFormAdd, , strPayor
            'Forms!frmPayor!txtGoTo = Me.Name
        If IsNothing(DLookup("JTXTlASTfIRST", "tblPayor", "JTXTlASTfIRST = """ & strPayor & """")) Then
            pintResponse = acDataErrContinue
        Else
            pintResponse = acDataErrAdded
        End If
        'Me.Cwaamtrec.SetFocus
        Exit Sub
    End If
    pintResponse = acDataErrDisplay
    'Me.Cwaamtrec.SetFocus

On Error GoTo 0
Exit Sub
PayorName_NotInList_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PayorName_NotInList of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : PolicyNo_AfterUpdate
' Author    : Norbert
' Date      : 10/23/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub PolicyNo_AfterUpdate()
On Error GoTo PolicyNo_AfterUpdate_Error
Me.PolicyNo = UCase(Me.PolicyNo)
Me.Jtxtpolssn = Me.PolicyNo & Me.IsmaId

On Error GoTo 0
Exit Sub
PolicyNo_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PolicyNo_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : Potentialrefund_AfterUpdate
' Author    : Norbert
' Date      : 4/30/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Potentialrefund_AfterUpdate()
On Error GoTo Potentialrefund_AfterUpdate_Error
If Me.Potentialrefund = "YES" Then
    Me.Prevremit.Enabled = True
    Me.AmountToRefund.Enabled = True
    Me.ShredListDate = Now
    Me.Custfeerefamt.Enabled = True
    Me.Refundcomments.Enabled = True
    Me.RefundComments1.Enabled = True
Else
    Me.Prevremit.Enabled = False
    Me.ShredListDate = ""
    Me.AmountToRefund.Enabled = False
    Me.Custfeerefamt.Enabled = False
    Me.Refundcomments.Enabled = False
    Me.RefundComments1.Enabled = True
End If

On Error GoTo 0
Exit Sub
Potentialrefund_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Potentialrefund_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : PrcBusagent1_AfterUpdate
' Author    : Norbert
' Date      : 4/6/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub PrcBusagent1_AfterUpdate()
On Error GoTo PrcBusagent1_AfterUpdate_Error
Me.PrcBusagent2 = 1 - Me.ActiveControl

On Error GoTo 0
Exit Sub
PrcBusagent1_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PrcBusagent1_AfterUpdate of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : MissingMasterInfo
' Author    : Norbert
' Date      : 5/8/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Public Function MissingMasterInfo() As Boolean
'as per Brenda 051013 changes

Dim bResult As Boolean
Dim strMissing As String
strMissing = ""
Select Case Me.CollectionMode
    Case "EFT", "Fed Allot", "PRD", "Direct Bill", "CCard"
        If IsNothing(Me.Wdccycle) Then strMissing = "Coll Cycle"
        If IsNothing(Me.RemPmtCycle) Then strMissing = "Remittance Payment Cycle"
        If IsNothing(Me.PaymentStatus) Then strMissing = "Payment Status"
    Case Else
        If Me.RemPmtCycle <> "WDC" Then strMissing = "Remmittance Payment Cycle<>WDC"




End Select

If IsNothing(Me.ReqIssueDate) Then strMissing = "Req Issue Date"
If IsNothing(Me.Cwaamtrec) Then strMissing = strMissing & ",Total CWA Amt"
If IsNothing(Me.CompanycodeLoanNo) Then strMissing = strMissing & ",Vendor"
If IsNothing(Me.PolicyNo) Then strMissing = strMissing & ",Pol No"
If IsNothing(Me.prodcde) Then strMissing = strMissing & ",Prod"
If IsNothing(Me.IsmaProductCode) Then strMissing = strMissing & ",Code"
If IsNothing(Me.CollectionMode) Then strMissing = strMissing & ",Coll Mode"
If IsNothing(Me.ApplicationDate) Then strMissing = strMissing & ",App Date"
If IsNothing(Me.Productstatus) Then strMissing = strMissing & ",Prod,Status"
If IsNothing(Me.TransmittalDate) Then strMissing = strMissing & ",NB,TDate"
If IsNothing(Me.CustodialBank) Then strMissing = strMissing & ",Cst Bk"
'If IsNothing(Me.Flex) Then strMissing = strMissing & ",Flex"
If IsNothing(Me.Combo) Then strMissing = strMissing & ",Combo"
If IsNothing(Me.RemPmtCycle) Then strMissing = strMissing & ",Remittance Payment Cycle"
If IsNothing(Me.PaymentStatus) Then strMissing = strMissing & ",Payment Status"
If IsNothing(Me.Writingstate) Then strMissing = strMissing & ",State Issued"
If IsNothing(Me.Lastknownbene) Then strMissing = strMissing & ",Last Known Beneficiary"
If IsNothing(Me.AgentID) Then strMissing = strMissing & ",AGENT ID1"

If Left(strMissing, 1) = "," Then
    strMissing = Mid(strMissing, 2)
End If

If Not IsNothing(strMissing) Then
    MsgBox "MISSING INFORMATION IN: " & vbCrLf & vbCrLf & _
        UCase(strMissing), vbCritical, "REQUIERD FIELDS MUST BE FILLED OUT"
End If


On Error GoTo MissingMasterInfo_Error
    MissingMasterInfo = bResult

On Error GoTo 0
Exit Function
MissingMasterInfo_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure MissingMasterInfo of VBA Document Form_frmMaster"

End Function

'---------------------------------------------------------------------------------------
' Procedure : Prdbillingcycle_AfterUpdate
' Author    : Norbert
' Date      : 2/6/2014
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Prdbillingcycle_AfterUpdate()
On Error GoTo Prdbillingcycle_AfterUpdate_Error
DerivedMasterFields

On Error GoTo 0
Exit Sub
Prdbillingcycle_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Prdbillingcycle_AfterUpdate of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Prdcustodialfee_AfterUpdate
' Author    : Norbert
' Date      : 10/12/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Prdcustodialfee_AfterUpdate()
On Error GoTo Prdcustodialfee_AfterUpdate_Error
Me.RemittancePmtAmt = Nz(Me.Prdgrosscollamt, 0) - Nz(Me.Prdcustodialfee, 0)

On Error GoTo 0
Exit Sub
Prdcustodialfee_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Prdcustodialfee_AfterUpdate of VBA Document Form_frmMaster"

End Sub

'---------------------------------------------------------------------------------------
' Procedure : Prdgrosscollamt_AfterUpdate
' Author    : Norbert
' Date      : 5/31/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Prdgrosscollamt_AfterUpdate()
On Error GoTo Prdgrosscollamt_AfterUpdate_Error
'20140814
Me.RemittancePmtAmt = Nz(Me.Prdgrosscollamt, 0) - Nz(Me.Prdcustodialfee, 0)

On Error GoTo 0
Exit Sub
Prdgrosscollamt_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Prdgrosscollamt_AfterUpdate of VBA Document Form_frmMaster"
End Sub


'---------------------------------------------------------------------------------------
' Procedure : ProdCde_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub ProdCde_Change()
On Error GoTo ProdCde_Change_Error
Me.IsmaProductCode.SetFocus

On Error GoTo 0
Exit Sub
ProdCde_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ProdCde_Change of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Productstatus_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub Productstatus_Change()
On Error GoTo Productstatus_Change_Error
Me.TransmittalDate.SetFocus

On Error GoTo 0
Exit Sub
Productstatus_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Productstatus_Change of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Refundcomments_Change
' Author    : norbert
' Date      : 6/10/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub Refundcomments_Change()
   On Error GoTo Refundcomments_Change_Error

Me.txtCtLetters = Len(Me.Refundcomments.Text)

If Me.txtCtLetters > 70 Then
    MsgBox "PLEASE CONTINUE TYPING IN THE THE LINE!", vbCritical, "ISM"
    Me.RefundComments1.SetFocus
End If

   On Error GoTo 0
   Exit Sub

Refundcomments_Change_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Refundcomments_Change of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : tgACHAccard_Click
' Author    : norbert
' Date      : 7/24/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub tgACHAccard_Click()
On Error GoTo tgACHAccard_Click_Error
If Me.lblWarningMaster.Caption <> "EDIT!" Then
    MsgBox "PLEASE SAVE THE NEW RECORD AND THEN EDIT IT THEN PERFORM THIS PROCESS", vbCritical, "ISM"
    Exit Sub
End If
'20141211--------------------------------------------
If Me.CustodialBank = "AF" Then
        With Forms!frmMaster!fSubDailyACHCcard
        If Me.CollectionMode = "EFT" Or Me.CollectionMode = "CCard" Then
             .Visible = True
             .SetFocus
             .Form.AllowEdits = True
             .Form.AllowAdditions = True
              Me.AllowAdditions = True
             If !ACHCcard = True Then Exit Sub
                    DoCmd.GoToRecord , "", acNewRec
                    !MasterfileNo = [Forms]![frmMaster]![MasterfileNo]
                    !CustodialFee = Format(IIf(IsNothing(Forms!frmMaster!EFTCustodialFee), 0, Forms!frmMaster!EFTCustodialFee), "0.00")
                    !Fecoll = Format(IIf(IsNothing(Forms!frmMaster!Fecoll), 0, Forms!frmMaster!Fecoll), "0.00")
                    !ClientName = Forms!frmMaster!ClientName
                    !Vendorname = Forms!frmMaster!PayorName.Column(1)
                    !Premium = Format(Forms!frmMaster!RemittancePmtAmt, "0.00")
                    !ACHCcard = True
                    !PolicyNo = Me.PolicyNo
                    !TranDate = Date
                    !cboApply.SetFocus
                    .Form.AllowAdditions = False
              End If
         End With
 End If
 On Error GoTo 0
Exit Sub

tgACHAccard_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure tgACHAccard_Click of VBA Document Form_frmMaster"
End Sub
   
'---------------------------------------------------------------------------------------
' Procedure : txtPriorMasterFileNo_Click
' Author    : Norbert
' Date      : 11/18/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub txtPriorMasterFileNo_Click()
On Error GoTo txtPriorMasterFileNo_Click_Error

DoCmd.OpenForm "frmMaster", , , "MasterFileNo=" & Forms!frmMaster!txtPriorMasterFileNo, , , Me.Name
Me.txtPriorMasterFileNo.Visible = False
If Nz(DCount("*", "QS_TransRouteTRAcct")) > 1 Then
    DoCmd.OpenForm "frmTransRouteTRAcct", acNormal, , , , acDialog, Me.Name
End If
If Nz(DCount("*", "QS_TransCcardAcct")) > 1 Then
    'Forms!frmTransCcardAcct.Visible = True
    DoCmd.OpenForm "frmTransCcardAcct", acNormal, , , , acDialog, Me.Name
    'Forms!frmTransCcardAcct.Visible = True
End If


On Error GoTo 0
Exit Sub

txtPriorMasterFileNo_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtPriorMasterFileNo_Click of VBA Document Form_frmMaster"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : WantsFund_Change
' Author    : Norbert
' Date      : 5/14/2013
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Private Sub WantsFund_Change()
On Error GoTo WantsFund_Change_Error
Me.freeze.SetFocus

On Error GoTo 0
Exit Sub
WantsFund_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure WantsFund_Change of VBA Document Form_frmMaster"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : DerivedMasterFields
' Author    : Norbert
' Date      : 2/6/2014
' Purpose   : W-TPA
'---------------------------------------------------------------------------------------
Public Sub DerivedMasterFields()
On Error GoTo DerivedMasterFields_Error
Dim Epmt As Currency
Dim PPmt As Currency
Dim IPmt As Currency
'20140414
Me.AllowEdits = True
If IsNothing(Me.Adb) Then Me.Adb = 0
Me.LastLookedAtDate = Date
If IsNothing(Me.Mastcreatedate) Then Me.Mastcreatedate = Date
If Me.PreNoteDate.Visible = True Then
    If IsNothing(Me.PreNoteDate) Then
        Me.PreNoteDate = Date
    End If
End If
'20140316
Me.ClientPayorSSN = IIf(Not IsNothing(Me.IsmaId2), Me.IsmaId2, IsmaId)
'20140408 derived fields for PPMT MEPMT IEPMT------------------------------
'MEPMT------
Epmt = Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0)

If Nz(Me.EFTCollCycle = "BiWeekly", Null) Then
    If Nz(Me.RemPmtCycle = "BiWeekly", Null) Then
        Me.MEpmt = (Epmt * 26) / 26
    Else
        Me.MEpmt = (Epmt * 26) / 13
    End If
Else
    If Nz(Me.EFTCollCycle = "Monthly", Null) Then
        If Nz(Me.RemPmtCycle, Null) = "BiWeekly" Then
              Me.MEpmt = (Epmt * 12) / 26
        Else
              Me.MEpmt = (Epmt * 12) / 13
               
        End If
    End If
End If
'PPMT------------

PPmt = Nz(Me.Prdgrosscollamt, 0) - Nz(Me.Prdcustodialfee, 0)

If Me.IsmaProductCode <> "Association" Then
    If Nz(Me.DeductionCycle, Null) = "Weekly" Then
        If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
            Me.PPmt = (PPmt * 52) / 26
        Else
            Me.PPmt = (PPmt * 52) / 12
        End If
    ElseIf Nz(Me.DeductionCycle, Null) = "BiWeekly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 26) / 26
                Else
                    Me.PPmt = (PPmt * 26) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "Semi-Monthly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 24) / 26
                Else
                    Me.PPmt = (PPmt * 24) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "Monthly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 12) / 26
                Else
                    Me.PPmt = (PPmt * 12) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "Weekly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 52) / 12
                Else
                    Me.PPmt = (PPmt * 52) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "BiWeekly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 26) / 12
                Else
                    Me.PPmt = (PPmt * 26) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "Semi-Monthly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 24) / 12
                Else
                    Me.PPmt = (PPmt * 24) / 12
                End If
    ElseIf Nz(Me.DeductionCycle, Null) = "Monthly" Then
                If Nz(Me.Prdbillingcycle, Null) = "Biweekly" Then
                    Me.PPmt = (PPmt * 12) / 12
                Else
                    Me.PPmt = (PPmt * 12) / 12
                End If
    Else
            Me.PPmt = Null
    End If
End If

'IPMT------------
IPmt = Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0)


If Nz(Me.EFTCollCycle = "BiWeekly", Null) Then
    If Nz(Me.RemPmtCycle = "BiWeekly", Null) Then
        Me.IEpmt = (Epmt * 26) / 26
    Else
        Me.IEpmt = (Epmt * 26) / 12
    End If
Else
    If Nz(Me.EFTCollCycle = "Monthly", Null) Then
        If Nz(Me.RemPmtCycle, Null) = "BiWeekly" Then
              Me.IEpmt = (Epmt * 12) / 26
        Else
              Me.IEpmt = (Epmt * 12) / 12
               
        End If
    End If
End If


'Me.MEpmt = IIf(Nz(Me.EFTCollCycle = "BiWeekly", ""), IIf(Nz(Me.RemPmtCycle = "Biweekly", ""), ((Me.Eftgrosscollamt - Me.EFTCustodialFee) * 26) / 26, ((Me.Eftgrosscollamt - Me.EFTCustodialFee) * 26) / 13), IIf(Nz(Me.EFTCollCycle = "Monthly", ""), IIf(Nz(Me.RemPmtCycle = "Biweekly", ""), ((Me.Eftgrosscollamt - Me.EFTCustodialFee) * 12) / 26, ((Me.Eftgrosscollamt - Me.EFTCustodialFee) * 12) / 13), Null))



Me.RemittancePmtAmt = IIf(Me.CollectionMode = "PRD" Or Me.CollectionMode = "Payrec", Me.PPmt, IIf(Me.CollectionMode = "EFT", IIf(Me.IsmaProductCode = "Mortgage", Nz(Me.MEpmt, 0), Nz(Me.IEpmt, 0)), _
                              IIf(Me.CollectionMode = "Fed Allot", Nz(Me.IEpmt, 0), IIf(Me.CollectionMode = "CCard", Nz(Me.Eftgrosscollamt, 0) - Nz(Me.EFTCustodialFee, 0), Nz(Me.RemittancePmtAmt, 0)))))


Me.Calcbillamt = IIf(Me.DeductionCycle = "weekly", IIf(Me.Prdbillingcycle = "Biweekly", (Me.Prdgrosscollamt * 52) / 26, (Me.Prdgrosscollamt * 52) / 12), _
                 IIf(Me.DeductionCycle = "Biweekly", IIf(Me.Prdbillingcycle = "Biweekly", (Me.Prdgrosscollamt * 26) / 26, (Me.Prdgrosscollamt * 26) / 12), _
                 IIf(Me.DeductionCycle = "Semi-Monthly", IIf(Me.Prdbillingcycle = "Biweekly", (Me.Prdgrosscollamt * 24) / 26, (Me.Prdgrosscollamt * 24) / 12), _
                 IIf(Me.DeductionCycle = "Monthly", IIf(Me.Prdbillingcycle = "Biweekly", (Me.Prdgrosscollamt * 12) / 26, Me.Prdgrosscollamt), Null))))
'20140227---due to labels
Me.Mastcreatedate = IIf(IsNothing(Me.Mastcreatedate), Date, Me.Mastcreatedate)
On Error GoTo 0
Exit Sub
DerivedMasterFields_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure DerivedMasterFields of VBA Document Form_frmMaster"
End Sub


'---------------------------------------------------------------------------------------
' Procedure : NeedInfo
' Author    : norbert
' Date      : 5/22/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Public Function NeedInfo() As Boolean
Dim bResult As Boolean
On Error GoTo NeedInfo_Error
If Me!fSubDailyACHCcard.Form.Visible Then
    If IsNothing(Me!fSubDailyACHCcard.Form.Amt) Then
        MsgBox "MISSING INFORMATION IN FORM: 'CWA AND DAILY-ACH/CCARD'" & vbCrLf & "PLEASE FILL THE MISSING INFORMATION OR DELETE THE FORM", vbCritical, "ISM"
        bResult = True
        GoTo ExitNeedInfo
    End If
End If

If Me.Otherowner = "YES" Then
    If Nz(DCount("*", "qryOwnerInfo", "OwnerPolicyNo='" & Me.PolicyNo & "'")) > 0 Then
        MsgBox "MISSING OWNER INFORMATION" & vbCrLf & "EITHER LAST OR FIRST NAME, ANY ADDRESS INFORMATION" & vbCrLf & "UNTIL ALL INFORMATION IS CORRECT CHANGE Other Owner to 'NO'", vbCritical, "ISM"
        Me.Otherowner.SetFocus
        bResult = True
        GoTo ExitNeedInfo
    Else
        If Nz(DCount("*", "tblOwner", "OwnerPolicyNo='" & Me.PolicyNo & "'")) = 0 Then
            MsgBox "NO OTHER OWNER!" & vbCrLf & "OTHER OWNER WILL BE CHANGE TO 'NO'", vbCritical, "ISM"
            Me.Otherowner = "NO"
            RunCommand acCmdSaveRecord
            bResult = True
            GoTo ExitNeedInfo
        End If
   
    End If
End If
If IsNothing(Me.ClientName) Then
    MsgBox "NEED CLIENT NAME", vbCritical, "ISM"
    Me.cmdClient.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.CompanycodeLoanNo) Then
    MsgBox "NEED VENDOR NAME", vbCritical, "ISM"
    Me.cmdIns.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.CollectionMode) Then
    MsgBox "NEED COLLECTION MODE", vbCritical, "ISM"
    Me.CollectionMode.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.Productstatus) Then
    MsgBox "NEED PRODUCT STATUS", vbCritical, "ISM"
    Me.Productstatus.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.CustodialBank) Then
    MsgBox "NEED CUSTODIAL BANK", vbCritical, "ISM"
    Me.CustodialBank.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.Productstatus) Then
    MsgBox "NEED PRODUCT STATUS", vbCritical, "ISM"
    Me.Productstatus.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
If IsNothing(Me.IsmaProductCode) Then
    MsgBox "NEED PRODUCT CODE", vbCritical, "ISM"
    Me.IsmaProductCode.SetFocus
    bResult = True
    GoTo ExitNeedInfo
End If
'---------------------------------------------------------------------------------


ExitNeedInfo:

    NeedInfo = bResult

   On Error GoTo 0
   Exit Function

NeedInfo_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure NeedInfo of VBA Document Form_frmMaster"

End Function


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (15)

.

__,_._,___

Tidak ada komentar:

Posting Komentar