Solved Definitions of property procedures for the same property are inconsistent (1 Viewer)

Pac-Man

Active member
Local time
Tomorrow, 02:15
Joined
Apr 14, 2020
Messages
416
Hello,

I am trying to write following property procedure in a class module but I'm getting error message that Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, PramArray, or Invalid Set final parameter. Where am I doing wrong. Please help.

SQL:
Public Property Get SettingsTableName(SettingsTable_Location As enSettingsTblLocation) As String
    If SettingsTable_Location = BE_Settings Then
        SettingsTableName = Prop("AppBESettingsTableName", "tblSettings")
    Else
        SettingsTableName = Prop("AppFESettingsTableName", "tblSettingsLocal")
    End If
End Property

Public Property Let SettingsTableName(ByVal sTableName As String, ByVal SettingsTable_Location As enSettingsTblLocation)
    If SettingsTable_Location = BE_Settings Then
        Prop("AppBESettingsTableName") = sTableName
    Else
        Prop("AppFESettingsTableName") = sTableName
    End If
End Property
 
Last edited:

sonic8

AWF VIP
Local time
Today, 23:15
Joined
Oct 27, 2015
Messages
998
I'm getting error message that Definitions of property procedures for the same property are inconsistent.
There are two problems with your code, which trigger this error.
1.) The argument in the Let procedure matching the return value of the Get procedure (sTableName in your case) must be the last argument in the list.
2.) The passing mechanism (ByVal/ByRef) of the other arguments must be the same for both property procedures.

Although not a technical problem, I still like to mention it: Even though it works, passing arguments to property procedures is very unusual. I think I've never seen this except for some array-like, indexed properties. Thus, this will very likely confuse developers looking at the code.
I would consider either splitting the property procedure into two individual properties for BE/FE and/or using a Sub/Function pair instead of the properties.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:15
Joined
May 7, 2009
Messages
19,245
what is prop() i guess it is Another Property since you are assigning to it.
 

Pac-Man

Active member
Local time
Tomorrow, 02:15
Joined
Apr 14, 2020
Messages
416
There are two problems with your code, which trigger this error.
1.) The argument in the Let procedure matching the return value of the Get procedure (sTableName in your case) must be the last argument in the list.
2.) The passing mechanism (ByVal/ByRef) of the other arguments must be the same for both property procedures.

Although not a technical problem, I still like to mention it: Even though it works, passing arguments to property procedures is very unusual. I think I've never seen this except for some array-like, indexed properties. Thus, this will very likely confuse developers looking at the code.
I would consider either splitting the property procedure into two individual properties for BE/FE and/or using a Sub/Function pair instead of the properties.
Thanks, removin byval and switching positions of Let parameters solved the issue. Thanks again.
 

Users who are viewing this thread

Top Bottom