Is there a way calling a Property Let method from inside the same class?
Like this function SetConnectionDetails. But this one gets a Compile error: Invalid use of property…
Public Sub SetConnectionDetails(ByVal strServer As String, ByVal strDatabase As String, ByVal strUser As String, ByVal strPassword As String)
Server (strServer)
User (strUser)
Password (strPassword)
Database (strDatabase)
End Sub
Property Let Server(ByVal value As String)
lServer = value
End Property
Property Let User(ByVal value As String)
lUser = value
End Property
Property Let Password(ByVal value As String)
lPassword = value
End Property
Property Let Database(ByVal value As String)
lDatabase = value
End Property
You call it as a normal property/variable:
Or, more explicitly:
Note that I’ve removed the () around the values/parameters is they shouldn’t (normally) be there, and may catch you out later.