XLEAccessGuru
XLEGuru
- Local time
- Today, 12:38
- Joined
- Nov 17, 2006
- Messages
- 65
Hey all,
I've been using this SetProperties code successfully in databases for some time now. I added it to another database but all of a sudden I'm getting "property not found" error on the line
Code:
'dbs.properties(strPropName)=varPropValue
There is a trap in there (see full function below) that is supposed to take care of this error but it's not working. I've checked all my references and they are all there as they should be so it's not a reference issue.
Any ideas why the trapper isn't working??? Please help - I'm desperate to fix this. I can't use Access user-level security for this lockdown so I really need this to work - and REAL soon. Thanks fellow gurus!
Code:
Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
SetProperties = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
SetProperties = False
Resume Change_Bye
End If
End Function