Hi all
I found this piece of code on a login form that I am using on my database.
The issue I have is when I compile it, it gives me a compile error: "Expected user-defined type, not object"
How do I fix this?
I found this piece of code on a login form that I am using on my database.
The issue I have is when I compile it, it gives me a compile error: "Expected user-defined type, not object"
How do I fix this?
Code:
Public Function SetProperties(PropName As String, PropType As Variant, PropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As Database, prop As Property
Set db = CurrentDb
db.Properties(PropName) = PropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then
Set prop = db.CreateProperty(PropName, PropType, PropValue)
db.Properties.Append prop
Resume Next
Else
Set Properties = False
MsgBox "runtime Error #" & Err.Number & vbCrLf & vbLf & Err.Description
Resume Exit_SetProperties
End If