Hello all, I have a front end that I created using Access 2003. I few years back I found a post with the coding to Changeproperty at login (parts of it below), so if the person logging in is setup as an "Admin", then they have access to everything, however, if the person is setup as a User, then the DB opens with limited properties. This works well in Access 2007 unless....I compact on close, then I get a "property not found" error message and the debug takes me to the below code at "CurrentPropVal = dbs.Properties(strPropName)"
Is anyone aware if Access 2007 made a change that doesn't recognize the below? if so, what do I need to do?
any help is really appreciated.
-----------------------------------------------------------
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant, Restart As Boolean) As Integer
Dim dbs As Database, prp As Property
Dim CurrentPropVal As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
CurrentPropVal = dbs.Properties(strPropName)
If CurrentPropVal <> varPropValue Then
dbs.Properties(strPropName) = varPropValue
Restart = True 'need to restart database
End If
ChangeProperty = 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.
ChangeProperty = False
Resume Change_Bye
End If
End Function