Solved Definitions of property procedures for the same property are inconsistent

Pac-Man

Active member
Local time
Tomorrow, 01:01
Joined
Apr 14, 2020
Messages
429
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:
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.
 
what is prop() i guess it is Another Property since you are assigning to it.
 
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

Back
Top Bottom