Property error message

  • Thread starter Thread starter Dennis Snelgrove
  • Start date Start date
D

Dennis Snelgrove

I'm attempting my first Class module, and I'm batting 1000 so far - my
first Propery pair has crapped out on me. <s> I'm getting the following
message when it goes to compile. The offensive code follows. Can anyone
explain what the problem is? My data type is consistent from my Let to
my Get. I'm not using a ParamArray or Optional parameter.

Thanks...

"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"


----- Code begins

Option Compare Database
Option Explicit
Option Base 1

Private Type LineDirection
North As Boolean
South As Boolean
East As Boolean
West As Boolean
End Type

Private Type DetailLines
DeptDiv As LineDirection
DivSect As LineDirection
SectLoc As LineDirection
End Type

Dim mRecs As DAO.Recordset
Dim mLines(500) As DetailLines
Dim mSQLSource As String
Dim mSQLSourceSet As Boolean
Dim mCurrentIndex As Integer


Property Get SQLSource()

SQLSource = mSQLSource
End Property

Property Let SQLSource(ByVal pSQLSource As String)

Dim Dummy As Integer

On Error GoTo HandleError

If Len(pSQLSource) > 0 Then
Set mRecs = CurrentDb.OpenRecordset(pSQLSource)
mSQLSourceSet = True
Else
Set mRecs = Nothing
mSQLSourceSet = False
End If

mSQLSource = pSQLSource
Exit Property

HandleError:
Dummy = MsgBox("That's not a valid source!", vbOKOnly,
"Recordsource BooBoo!!")
Set mRecs = Nothing
mSQLSourceSet = False
End Property

Private Sub Class_Initialize()

Set mRecs = Nothing
mSQLSourceSet = False
End Sub

Private Sub Class_Terminate()

Set mRecs = Nothing
End Sub
 
IMHO, you have to declare property get as string also:

Property Get SQLSource() as string
 
Property Get SQLSource() ....

Property Let SQLSource(ByVal pSQLSource As String)

As Alex points out, the first line says that SQLSource is a Variant when it
comes out, and the second one says it's a String when it goes in. The two
statements must match exactly.

HTH


Tim F
 
Back
Top