Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change property with Access 2007

Status
Not open for further replies.

MJD1

Technical User
Jul 18, 2003
134
CA

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
 
ok, I figured it out...Access 2007 doesn't seem to recognize the following

" 'ChangeProperty "StartupMenuBar", dbText, "(default)", Restart"

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top