Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Error When Opening Form
Michael Santiago 

7 months ago
Good morning,

I am getting this error when I attempt to open a particular form:

The expression On Current you entered as the event property setting produced the following error: Object or class does not support the set of events.

When I click ok, the form opens but the VBA coding seems to not be working. If I open the VBA code and close it out, then reopen the form, everything works fine. But when I close access and reopen the database, this error appears again.

How do I get to the cause of this?

Thanks in advance!
Michael Santiago OP  @Reply  

7 months ago

Sami Shamma  @Reply  
             
7 months ago
Show your code
Michael Santiago OP  @Reply  

7 months ago
DetailsOption Compare Database
Option Explicit


Private Sub Active_Toggle_AfterUpdate()
    If Active_Toggle Then
        Active_Toggle.Caption = "P"
    Else
        Active_Toggle.Caption = ""
    End If
End Sub

Private Sub Auditor_AfterUpdate()
    If Auditor Then
        Auditor.Caption = "P"
    Else
        Auditor.Caption = ""
    End If
End Sub

Private Sub cmdEmail_Click()

    Dim Msg As String
    
    Msg = "Dear " & First_Name & ","
    
    Dim O As Outlook.Application
    Dim M As Outlook.MailItem
    
    If Nz(Me.[SHU_Email], "") = "" Then
     MsgBox "There is no email address entered."
    
    Else
    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)
    
    With M
        .BodyFormat = olFormatHTML
        .HTMLBody = Msg
        .To = SHU_Email
        .Display
                
    End With
    
    Set M = Nothing
    Set O = Nothing
    End If
    
End Sub

Private Sub Financial_Aid_AfterUpdate()
    If Financial_Aid Then
        Financial_Aid.Caption = "P"
    Else
        Financial_Aid.Caption = ""
    End If
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

    LastUpdated = Now()
    UserUpdated = TempVars("Username")
    
End Sub

Private Sub Graduated_AfterUpdate()
    If Graduated Then
        Graduated.Caption = "P"
    Else
        Graduated.Caption = ""
    End If
End Sub

Private Sub Itinerancy_AfterUpdate()
    If Itinerancy Then
        Itinerancy.Caption = "P"
    Else
        Itinerancy.Caption = ""
    End If
End Sub

Private Sub On_Leave_AfterUpdate()
    If On_Leave Then
        On_Leave.Caption = "P"
    Else
        On_Leave.Caption = ""
    End If
End Sub

Private Sub OPT_CPT_AfterUpdate()
    If OPT_CPT Then
        OPT_CPT.Caption = "P"
    Else
        OPT_CPT.Caption = ""
    End If
End Sub



Private Sub Return_Grad_AfterUpdate()
    If Return_Grad Then
        Return_Grad.Caption = "P"
    Else
        Return_Grad.Caption = ""
    End If
End Sub

Private Sub Senior_AfterUpdate()
    If Senior Then
        Senior.Caption = "P"
    Else
        Senior.Caption = ""
    End If
End Sub

Private Sub SEVIS_AfterUpdate()
    If SEVIS Then
        SEVIS.Caption = "P"
    Else
        SEVIS.Caption = ""
    End If
End Sub

Private Sub Form_Current()

    SEVIS_AfterUpdate
    Senior_AfterUpdate
    Return_Grad_AfterUpdate
    OPT_CPT_AfterUpdate
    On_Leave_AfterUpdate
    Itinerancy_AfterUpdate
    Graduated_AfterUpdate
    Financial_Aid_AfterUpdate
    Auditor_AfterUpdate
    Active_Toggle_AfterUpdate
    UgradMajor_AfterUpdate
    
End Sub

Private Sub UgradMajor_AfterUpdate()
    If [UndergradMajor] = "Catholic Theology - Philosophy Track (THPH)" Then
    PLTL1111.Visible = True
    PLTL1112.Visible = True
    PLTL1113.Visible = True
    PLTL1242.Visible = True
    PLTL2218.Visible = True
    PLTL2241.Visible = True
    PLTL2243.Visible = True
    PLTL3214.Visible = True
    PLTL3416.Visible = True
    THEO1102.Visible = True
    THEO1203.Visible = True
    THEO1404.Visible = True
    THEO1501.Visible = True
    THEO1502.Visible = True
    BIBL3106.Visible = True
    BIBL3107.Visible = True
    THEO2514.Visible = False
    LATN1101.Visible = False
    LATN1102.Visible = False
    PhilosophyRequirement1.Visible = False
    PhilosophyRequirement1Grade.Visible = False
    PhilosophyRequirement2.Visible = False
    PhilosophyRequirement2Grade.Visible = False
    PhilosophyElective.Visible = False
    PhilosophyElectiveGrade.Visible = False
    AdvancedTheologyElective1.Visible = True
    AdvancedTheologyElective1Grade.Visible = True
    AdvancedTheologyElective2.Visible = True
    AdvancedTheologyElective2Grade.Visible = True
    AdvancedTheologyElective3.Visible = True
    AdvancedTheologyElective3Grade.Visible = True
    AdvancedTheologyElective4.Visible = True
    AdvancedTheologyElective4Grade.Visible = True
    AdvancedTheologyElective5.Visible = False
    AdvancedTheologyElective5Grade.Visible = False
    AdvancedTheologyElective6.Visible = False
    AdvancedTheologyElective6Grade.Visible = False
    AdvancedTheologyElective7.Visible = False
    AdvancedTheologyElective7Grade.Visible = False
    ElectiveCount.Visible = True
    THPHElectiveRemaining.Visible = True
    THEOElectiveRemaining.Visible = False
    TheologyRequirement1.Visible = False
    TheologyRequirement1Grade.Visible = False
    TheologyRequirement2.Visible = False
    TheologyRequirement2Grade.Visible = False
    TheologyRequirement3.Visible = False
    TheologyRequirement3Grade.Visible = False

    ElseIf [UndergradMajor] = "Catholic Theology - Philosophy Track (THPH) w/Pre-Theology" Then
    PLTL1111.Visible = True
    PLTL1112.Visible = True
    PLTL1113.Visible = True
    PLTL1242.Visible = True
    PLTL2218.Visible = True
    PLTL2241.Visible = True
    PLTL2243.Visible = True
    PLTL3214.Visible = True
    PLTL3416.Visible = True
    THEO1102.Visible = True
    THEO1203.Visible = True
    THEO1404.Visible = True
    THEO1501.Visible = True
    THEO1502.Visible = True
    BIBL3106.Visible = True
    BIBL3107.Visible = True
    THEO2514.Visible = True
    LATN1101.Visible = True
    LATN1102.Visible = True
    PhilosophyRequirement1.Visible = False
    PhilosophyRequirement1Grade.Visible = False
    PhilosophyRequirement2.Visible = False
    PhilosophyRequirement2Grade.Visible = False
    PhilosophyElective.Visible = False
    PhilosophyElectiveGrade.Visible = False
    AdvancedTheologyElective1.Visible = False
    AdvancedTheologyElective1Grade.Visible = False
    AdvancedTheologyElective2.Visible = False
    AdvancedTheologyElective2Grade.Visible = False
    AdvancedTheologyElective3.Visible = False
    AdvancedTheologyElective3Grade.Visible = False
    AdvancedTheologyElective4.Visible = False
    AdvancedTheologyElective4Grade.Visible = False
    AdvancedTheologyElective5.Visible = False
    AdvancedTheologyElective5Grade.Visible = False
    AdvancedTheologyElective6.Visible = False
    AdvancedTheologyElective6Grade.Visible = False
    AdvancedTheologyElective7.Visible = False
    AdvancedTheologyElective7Grade.Visible = False
    ElectiveCount.Visible = False
    THPHElectiveRemaining.Visible = False
    THEOElectiveRemaining.Visible = False
    TheologyRequirement1.Visible = False
    TheologyRequirement1Grade.Visible = False
    TheologyRequirement2.Visible = False
    TheologyRequirement2Grade.Visible = False
    TheologyRequirement3.Visible = False
    TheologyRequirement3Grade.Visible = False
    
    ElseIf [UndergradMajor] = "Catholic Theology - Theology Track (THEO)" Then
    PLTL1111.Visible = False
    PLTL1112.Visible = False
    PLTL1113.Visible = False
    PLTL1242.Visible = False
    PLTL2218.Visible = False
    PLTL2241.Visible = False
    PLTL2243.Visible = False
    PLTL3214.Visible = False
    PLTL3416.Visible = False
    THEO1102.Visible = True
    THEO1203.Visible = True
    THEO1404.Visible = True
    THEO1501.Visible = True
    THEO1502.Visible = True
    BIBL3106.Visible = True
    BIBL3107.Visible = True
    THEO2514.Visible = False
    LATN1101.Visible = False
    LATN1102.Visible = False
    PhilosophyRequirement1.Visible = True
    PhilosophyRequirement1Grade.Visible = True
    PhilosophyRequirement2.Visible = True
    PhilosophyRequirement2Grade.Visible = True
    PhilosophyElective.Visible = True
    PhilosophyElectiveGrade.Visible = True
    AdvancedTheologyElective1.Visible = True
    AdvancedTheologyElective1Grade.Visible = True
    AdvancedTheologyElective2.Visible = True
    AdvancedTheologyElective2Grade.Visible = True
    AdvancedTheologyElective3.Visible = True
    AdvancedTheologyElective3Grade.Visible = True
    AdvancedTheologyElective4.Visible = True
    AdvancedTheologyElective4Grade.Visible = True
    AdvancedTheologyElective5.Visible = True
    AdvancedTheologyElective5Grade.Visible = True
    AdvancedTheologyElective6.Visible = True
    AdvancedTheologyElective6Grade.Visible = True
    AdvancedTheologyElective7.Visible = True
    AdvancedTheologyElective7Grade.Visible = True
    ElectiveCount.Visible = True
    THPHElectiveRemaining.Visible = False
    THEOElectiveRemaining.Visible = True
    TheologyRequirement1.Visible = False
    TheologyRequirement1Grade.Visible = False
    TheologyRequirement2.Visible = False
    TheologyRequirement2Grade.Visible = False
    TheologyRequirement3.Visible = False
    TheologyRequirement3Grade.Visible = False
    
    ElseIf [UndergradMajor] = "Catholic Theology Minor (THEL)" Then
    PLTL1111.Visible = False
    PLTL1112.Visible = False
    PLTL1113.Visible = False
    PLTL1242.Visible = False
    PLTL2218.Visible = False
    PLTL2241.Visible = False
    PLTL2243.Visible = False
    PLTL3214.Visible = False
    PLTL3416.Visible = False
    THEO1102.Visible = False
    THEO1203.Visible = False
    THEO1404.Visible = False
    THEO1501.Visible = False
    THEO1502.Visible = False
    BIBL3106.Visible = False
    BIBL3107.Visible = False
    THEO2514.Visible = False
    LATN1101.Visible = False
    LATN1102.Visible = False
    PhilosophyRequirement1.Visible = False
    PhilosophyRequirement1Grade.Visible = False
    PhilosophyRequirement2.Visible = False
    PhilosophyRequirement2Grade.Visible = False
    PhilosophyElective.Visible = False
    PhilosophyElectiveGrade.Visible = False
    AdvancedTheologyElective1.Visible = True
    AdvancedTheologyElective1Grade.Visible = True
    AdvancedTheologyElective2.Visible = True
    AdvancedTheologyElective2Grade.Visible = True
    AdvancedTheologyElective3.Visible = True
    AdvancedTheologyElective3Grade.Visible = True
    AdvancedTheologyElective4.Visible = False
    AdvancedTheologyElective4Grade.Visible = False
    AdvancedTheologyElective5.Visible = False
    AdvancedTheologyElective5Grade.Visible = False
    AdvancedTheologyElective6.Visible = False
    AdvancedTheologyElective6Grade.Visible = False
    AdvancedTheologyElective7.Visible = False
    AdvancedTheologyElective7Grade.Visible = False
    ElectiveCount.Visible = False
    TH
Michael Santiago OP  @Reply  

7 months ago
DetailsElectiveCount.Visible = False
    THPHElectiveRemaining.Visible = False
    THEOElectiveRemaining.Visible = False
    TheologyRequirement1.Visible = True
    TheologyRequirement1Grade.Visible = True
    TheologyRequirement2.Visible = True
    TheologyRequirement2Grade.Visible = True
    TheologyRequirement3.Visible = True
    TheologyRequirement3Grade.Visible = True
    
    Else
    PLTL1111.Visible = False
    PLTL1112.Visible = False
    PLTL1113.Visible = False
    PLTL1242.Visible = False
    PLTL2218.Visible = False
    PLTL2241.Visible = False
    PLTL2243.Visible = False
    PLTL3214.Visible = False
    PLTL3416.Visible = False
    THEO1102.Visible = False
    THEO1203.Visible = False
    THEO1404.Visible = False
    THEO1501.Visible = False
    THEO1502.Visible = False
    BIBL3106.Visible = False
    BIBL3107.Visible = False
    THEO2514.Visible = False
    LATN1101.Visible = False
    LATN1102.Visible = False
    PhilosophyRequirement1.Visible = False
    PhilosophyRequirement1Grade.Visible = False
    PhilosophyRequirement2.Visible = False
    PhilosophyRequirement2Grade.Visible = False
    PhilosophyElective.Visible = False
    PhilosophyElectiveGrade.Visible = False
    AdvancedTheologyElective1.Visible = False
    AdvancedTheologyElective1Grade.Visible = False
    AdvancedTheologyElective2.Visible = False
    AdvancedTheologyElective2Grade.Visible = False
    AdvancedTheologyElective3.Visible = False
    AdvancedTheologyElective3Grade.Visible = False
    AdvancedTheologyElective4.Visible = False
    AdvancedTheologyElective4Grade.Visible = False
    AdvancedTheologyElective5.Visible = False
    AdvancedTheologyElective5Grade.Visible = False
    AdvancedTheologyElective6.Visible = False
    AdvancedTheologyElective6Grade.Visible = False
    AdvancedTheologyElective7.Visible = False
    AdvancedTheologyElective7Grade.Visible = False
    ElectiveCount.Visible = False
    THPHElectiveRemaining.Visible = False
    THEOElectiveRemaining.Visible = False
    TheologyRequirement1.Visible = False
    TheologyRequirement1Grade.Visible = False
    TheologyRequirement2.Visible = False
    TheologyRequirement2Grade.Visible = False
    TheologyRequirement3.Visible = False
    TheologyRequirement3Grade.Visible = False
    
    End If
    
End Sub

Jeffrey Kraft  @Reply  
      
7 months ago
I'm going to guess that Debug/Compile went error free.

Open the editor and start putting ' in front of each line and then remove the ' from each line until you hit the right one. That is my I'm too lazy to figure out why and just go process of elimination. Or asked ChatGPT where you erred in your ways. And when you do that let it know what version you have.

I've had this happen as well on one of the fitness forms and eventually after I drank enough coffee, I saw the error in my ways.
Donald Blackwell  @Reply  
       
7 months ago
Hi Michael, as Jeffrey said, with that much code, it would be best to comment out each line of the on current event and then uncomment one line at a time, save it, close it, reopen it and see if the error occurs.

If it occurs with all the lines in the Form_Current event commented out, then it means there is an unclosed if/then block, loop, with, etc. somewhere.

Some other tips would be:

1) With your toggles (i.e. SEVIS_AfterUpdate(), etc.) I would recommend watching and copying the code from Richard's Large Check Box video extended cut and moving that code to a Global module to eliminate duplicate code so you don't have to scroll through so much.

2) In your  UgradMajor_AfterUpdate Sub, I would move the content from the "Else" section to the beginning of the Sub before the if/then block so that the defaults are set at the beginning then, in each class, you only have the change the value of the ones you want to be true, again reducing code and improving readability.
Raymond Spornhauer  @Reply  
          
7 months ago
Michael

The Error says there's a problem with your OnCurrent Event:

Private Sub Form_Current()

    SEVIS_AfterUpdate
    Senior_AfterUpdate
    Return_Grad_AfterUpdate
    OPT_CPT_AfterUpdate
    On_Leave_AfterUpdate
    Itinerancy_AfterUpdate
    Graduated_AfterUpdate
    Financial_Aid_AfterUpdate
    Auditor_AfterUpdate
    Active_Toggle_AfterUpdate
    UgradMajor_AfterUpdate
    
End Sub

If you can't use a breakpoint in the VBA to find it, I would try putting a remark ' on half of these at a time to see which one is causing the error.

You may also need to check your fields to make sure they're all actually boolean values.

Hope this helps,

-Raymond

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 6:25:25 AM. PLT: 1s