Compile error in Hidden module (1 Viewer)

Richard M

Registered User.
Local time
Today, 09:14
Joined
Sep 29, 2010
Messages
75
Need help in finding out how to unhide a module.

When the code reaches the statement "Call PersonalCalandarRead_AddN2" it gives me this error message that says:

Compile error in Hidden module:
Form_frmPersonalCalendarOutput_22_2Opening.
This error commonly occurs when code is incompatible with the version, platform, or achitectue of this application."

Code:
If txtHolder2 = 1 Then
        
        Call PersonalCalandarRead_AddN2
        DoEvents



This is where it jumps to:
Code:
Sub PersonalCalandarRead_AddN2()
Dim Criteria As String
Dim strAns2 As String
msgbox "N8.0"
'Criteria = "PerCalandarID =" & RecordNo1  'PerCalandarID finds record in tblPersonalCalandar (Totalcompleted)
'strAns2 = Nz(DLookup("[TotalRecipientsRead]", "tblPersonalCalandar", Criteria), 0)
msgbox "N8.1"
Criteria = "PerCalandarID =" & RecordNo1  'PerCalandarID finds record in tblPersonalCalandar
strAns2 = Nz(DLookup("[TotalRecipientsRead]", "tblPersonalCalandar", Criteria), 0)
msgbox "N8" & strAns2
If Me.cboEventStatus1 = "Not Started" Then
    msgbox "N9"
    'resets read counter to 0  added 7-25-17
    Dim db As Database, rs As Recordset
    'msgbox "EventStatus not started"
    Set db = CurrentDb
    Set rs = db.OpenRecordset("tblPersonalCalandar", DB_OPEN_DYNASET)
    rs.FindFirst Criteria
    rs.Edit
    rs("TotalRecipientsRead") = rs("TotalRecipientsRead") - 1
    rs("eventstatus") = Me.cboEventStatus1
    rs.Update
    msgbox "Read: " & rs("TotalRecipientsRead")
    'Resets EventStatus1 in tblPersonalCalandarSentTo to Not Started
    Set rs = db.OpenRecordset("tblPersonalCalandarSentTo", DB_OPEN_DYNASET)
    Criteria = "PerCalandarID =" & RecordNo1 & "And Sendto =" & SendTo
    rs.FindFirst Criteria
    rs.Edit
    rs("EventStatus1") = Me.cboEventStatus1
    rs("txtHolder") = Me.txtHolder
    rs("txtHolder2") = Me.txtHolder2
    rs.Update
    
    Set db = Nothing
    Set rs = Nothing
    msgbox "Status for " & Format(Me.cboPerEvent, "bold") & " Due Date: " & RepeatDateDue & " has not changed."
    Exit Sub
Else
    msgbox "N10"
    If Me.cboEventStatus1 = "Working" Then
                  
           DoCmd.SetWarnings False
            'sets the counter for record read in tblPersonalCalandar
            
            
            Set db = CurrentDb
            Set rs = db.OpenRecordset("tblPersonalCalandar", DB_OPEN_DYNASET)
            rs.FindFirst Criteria
            rs.Edit
            rs("TotalRecipientsRead") = rs("TotalRecipientsRead") + 1
            rs("eventstatus") = Me.cboEventStatus1
            rs.Update
            
            'sets the new settings for eventstatus, txtholder and txtholder2 in tblPersonalCalandarSentTo.
            Set db = CurrentDb
            'Updates the tblPerspnalCalandarSentTo
            Criteria = "PerCalandarID =" & RecordNo1 & "And Sendto =" & SendTo
            Set rs = db.OpenRecordset("tblPersonalCalandarSentTo", DB_OPEN_DYNASET)
            rs.FindFirst Criteria
            rs.Edit
            rs("EventStatus1") = Me.cboEventStatus1
            rs("txtHolder") = Me.txtHolder
            rs("txtHolder2") = Me.txtHolder2
            rs.Update
            
            Set db = Nothing
            Set rs = Nothing
            msgbox "Status for " & Format(Me.PerEvent, "bold") & " Due Date: " & RepeatDateDue & " is now working."
   
    Else
        'msgbox "N11"
        'if working working is not complete 1 will not be added to read in tblPersnolCalandar table.
       If msgbox("Is this event complete?", vbQuestion + vbYesNo, "  ") = vbNo Then
            'msgbox "N12"
            Call tbl_UpdatetblCalandarOutput_3  'added 6-26-17
            Me.Recalc   'added 6-26-17
            DoEvents    'added 6-26-17
            msgbox "Status for " & Format(Me.PerEvent, "bold") & " Due Date: " & RepeatDateDue & " is still working."
            Exit Sub    'added 6-23-17
       Else
            DoCmd.SetWarnings False
            'sets the counter for record read in tblPersonalCalandar
            'msgbox "N13"
            
            Set db = CurrentDb
            Set rs = db.OpenRecordset("tblPersonalCalandar", DB_OPEN_DYNASET)
            rs.FindFirst Criteria
            rs.Edit
            rs("TotalRecipientsRead") = rs("TotalRecipientsRead") + 1
            rs.Update
            Set db = Nothing
            Set rs = Nothing
            'Return            'UpdatetblCalandarOutput_3
            Call tbl_UpdatetblCalandarOutput_3
        End If
        msgbox "Status for " & Format(Me.PerEvent, "bold") & " Due Date: " & RepeatDateDue & " is deleted."
    End If
End If
End Sub
 

JHB

Have been here a while
Local time
Today, 16:14
Joined
Jun 17, 2012
Messages
7,732
If the problem is suddenly started try to do a "Compact and Repair".
Have you tried to step through the code in procedure/Sub PersonalCalandarRead_AddN2 to find out which code line cause the problem?
Here is a link how to set a breakpoint.
https://www.techonthenet.com/access/tutorials/vbadebug/debug02.php
Else post your database with some sample data + a description how to reproduce the problem.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:14
Joined
May 7, 2009
Messages
19,237
put the code in Form module, since you have Me keyword there and wont work. If you must put it in Standard Module, pass the Form reference. so instead of Me, use the form reference:


Call PersonalCalandarRead_AddN2(Me)




Sub PersonalCalandarRead_AddN2(frm As Form)
' replace all occurrence of
' Me with frm
 

Users who are viewing this thread

Top Bottom