error passing variable to class module

Rainbowhawk

Registered User.
Local time
Today, 16:05
Joined
Oct 8, 2007
Messages
54
Hi All

I am trying to pass a boolean variable to a class module

Code:
Set rps.ViewS = View

the code in the module that this in theory is calling reads as

Code:
Private ViewC As Boolean
 
Public Property Set ViewS(ByRef ViewA As Boolean)
Set ViewC = ViewA
End Property
 
Public Property Get ViewS() As Boolean
Set ViewS = ViewC
End Property

However I am getting the error message

Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameter.

Can Anyone Help?????

Thanks
 
Where is rps defined?
It would be more helpful to readers if you showed more/all code involved. We are guessing what that code is.
 
Hi

rps is defined as

Code:
Private rps As ReportPrintStatus

This is the name of the Class module

the full class module code reads as

Code:
Private WithEvents mrpt As Access.Report
Private WithEvents msecReportHeader As Access.[_SectionInReport]
Private mintCounter As Integer
Private ViewC As Boolean

Public Property Set Report(rpt As Access.Report)
   Const strEventKey As String = "[Event Procedure]"
   Set mrpt = rpt
   With mrpt
      .OnActivate = strEventKey
      .OnClose = strEventKey
      .OnDeactivate = strEventKey
      Set msecReportHeader = .Section(acHeader)
      msecReportHeader.OnPrint = strEventKey
    End With
End Property
Public Property Get Printed() As Boolean
    If View = True Then
    
        Printed = (mintCounter >= 2)
    Else
    
          Printed = (mintCounter >= 1)
          
    End If
          
End Property
 
Public Sub Term()
   On Error Resume Next
   Set msecReportHeader = Nothing
   Set mrpt = Nothing
End Sub
 
Private Sub mrpt_Activate()
   mintCounter = mintCounter - 1
End Sub
 
Private Sub mrpt_Close()
   Me.Term
End Sub
 
Private Sub mrpt_Deactivate()
   mintCounter = mintCounter + 1
End Sub
 
Private Sub msecReportHeader_Print(Cancel As Integer, PrintCount As Integer)
   mintCounter = mintCounter + 1
End Sub
 
Public Property Set ViewS(ViewA As Boolean)
ViewC = ViewA
End Property
 
Public Property Get ViewS() As Boolean
ViewS = ViewC
End Property
 
Have you had this class working previously?

I have limited experience with Class modules and have always used Let as compared to Set.

Should this
If View = True Then

be
If ViewC = True Then

Good luck.
 
It was working until i added the set and get procedures,

Will try to replace set with let and see if that works
 
Hi,

Replacing the line

Code:
Public Property Set ViewS(ByRef ViewA As Boolean)

with

Code:
Public Property Let ViewS(ByRef ViewA As Boolean)

worked

Many thanks
 

Users who are viewing this thread

Back
Top Bottom