doddwell
asked on
DisableByPassKey Access Data Project
Hello
I am trying to disable the use of the shift key on startup. I am using an Access 2003 (Access Data Project). I am using the change property function on the MS site but it has no effect.
I am using this function....it fails because the dbs variable is set to 'Nothing' when it gets to ' dbs.Properties(strPropName ) = varPropValue'
Function ChangeProperty(strPropName As String, _
varPropType As Variant, varPropValue As Variant) As Integer
' The current listing in Access help file which will
' let anyone who can open the db delete/reset any
' property created by using this function, since
' the call to CreateProperty doesn't use the DDL
' argument
'
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName ) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strProp Name, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
I am trying to disable the use of the shift key on startup. I am using an Access 2003 (Access Data Project). I am using the change property function on the MS site but it has no effect.
I am using this function....it fails because the dbs variable is set to 'Nothing' when it gets to ' dbs.Properties(strPropName
Function ChangeProperty(strPropName
varPropType As Variant, varPropValue As Variant) As Integer
' The current listing in Access help file which will
' let anyone who can open the db delete/reset any
' property created by using this function, since
' the call to CreateProperty doesn't use the DDL
' argument
'
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strProp
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No probs.
It was required back in Access 97.
And I'd say that many developers (myself included) have just kept using their same old stock function.
(I made the above function up just now :-)
It would work in Access 2000 onwards (which is where ADP's can feature too).
Your previous function would generally work in Access 2003 mdb's - but in an ADP there is no Jet engine processing, no DAO library - and the DAO objects (like CurrentDb) aren't created.
It was required back in Access 97.
And I'd say that many developers (myself included) have just kept using their same old stock function.
(I made the above function up just now :-)
It would work in Access 2000 onwards (which is where ADP's can feature too).
Your previous function would generally work in Access 2003 mdb's - but in an ADP there is no Jet engine processing, no DAO library - and the DAO objects (like CurrentDb) aren't created.
ASKER