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
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

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...
Avatar of Karen Schaefer

ASKER

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
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Karen Schaefer

ASKER

Thanks for the assistance
Avatar of Karen Schaefer

ASKER

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

;-)

jeff
Avatar of Karen Schaefer

ASKER

I wanted to give you the points for your time.
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
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo