Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America asked on

Set Obj as Class - Check to see if Class is active

I am creating a Class Module and I need to determine if the Class is currently active.  what is the proper syntax to determine this?  My Current attempt does not like the ".ISOpen"

Public Function ISCenter_Data_Load_Routine(Optional ByVal ReportName As String, _
                                            Optional ByVal MODName As String, _
                                            Optional ByVal recct As Long, _
                                            Optional ByVal ProcName As String, _
                                            Optional ByVal sErr As String) As Boolean

Dim objLog As New clsISCenterEventLogger
    
   On Error GoTo ISCenter_Data_Load_Routine_Error

    With objLog
        If .IsOpen = True Then
            objLog.OpenLogRecord ReportName:=ReportName, _
                                MODName:=MODName, _
                                ProcName:=ProcName
        Else
            objLog.CloseLogRecord RowsAffected:=recct, _
                                    ErrMsg:=sErr, _
                                    AdditionalInfo:="Tested using VBA class", _
                                    StepSucceeded:=1
        End If
    End With
 
   On Error GoTo 0
   Exit Function

ISCenter_Data_Load_Routine_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & _
        ") in procedure ISCenter_Data_Load_Routine of Module basEventLogger"

End Function

Open in new window


Here is my latest attempt to set the value:

Option Compare Database
Option Explicit

Private mIsOpen As Boolean
Property Get IsOpen() As Boolean
    mIsOpen = True
    IsOpen = mIsOpen
End Property

Open in new window

Microsoft AccessMicrosoft DevelopmentMicrosoft Office

Avatar of undefined
Last Comment
Jeffrey Coachman

8/22/2022 - Mon
Jeffrey Coachman

What is this "Class" doing?

Is it just used to detect if a particular object is open?

If so, there are simpler ways to do this besides creating a class...
ASKER
Karen Schaefer

Is it just used to detect if a particular object is open?

Yes,

I need to indicate which part of the function should be used depending on which object is open?

here is what I am using found solution elsewhere:

Property Get IsOpen() As Boolean
    IsOpen = IIf(EventID = 0, False, True)
End Property


Thanks.

K
ASKER CERTIFIED SOLUTION
Jeffrey Coachman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Karen Schaefer

Thanks for the assistance
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
Karen Schaefer

thanks as always.
Jeffrey Coachman

Then if your own post solved the issue , then that is what you should have accepted (not my post)

;-)

jeff
ASKER
Karen Schaefer

I wanted to give you the points for your time.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman

K,

How long have we been working together?
;-)

If you answer your own post, then accept your own answer.
;-)

Not knowing the full scope of your app or the function, ...My post was just to let you know that there are other ways to detect if an object is open.

My issue with you accepting my post is four-fold
1.  You solved your own issue, you posted the solution, hence you should accept your own post.
2. My post really did not provide any info on the alternate methods, so I will post the popular link here:  http://msdn.microsoft.com/en-us/library/office/bb243768%28v=office.12%29.aspx
3. Other members may be encouraged to see that existing member are so uplifted by the help they get on EE that they get to the point where they can solve there own issues.
4. Although I will fight for points I feel I deserve,  ...I honestly have enough of them.

So if you really want to thank me, just shoot me an email, ...and give yourself some much deserved credit.

;-)

JeffCoachman