D
Duane
I am having some difficulty with this code and am wondering if someone can
give me some assistance. I am experiencing this problem with all newly
created databases.
I have a label on my switchboard with the following code:
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click
'This ensures the user is the programmer needing to disable the Bypass Key
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?"
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
If strInput = "PASSWORD" Then 'just kidding, it isn't the real password
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
"The Bypass Key was disabled.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_bDisableBypassKey_Click:
Exit Sub
Err_bDisableBypassKey_Click:
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
Resume Exit_bDisableBypassKey_Click
End Sub
---------------
I have a module with the rest of the code:
Public Function SetProperties(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
I am using XP Office. I have my Library references set the same as with the
databases that this code is working correctly in, including the DAO
reference. When I double click the label and enter the password I receive
the following error; Run Time Error 3270. Property not found. I set a
breakpoint and stepped through the code and have found the code breaking on
the db.Properties(strPropName) = varPropValue. When I hover over the
breakpoint, I see where it tells me db.Properties(strPropName) = <Property
Not Found>. If I go to the first line in the function where it says Public
Function SetProperties(strPropName As String, - and hover over the
variable it tells me strPropName = "AllowByPassKey"
I sure could use some help. But for now, it's bedtime. Thanks in advance.
give me some assistance. I am experiencing this problem with all newly
created databases.
I have a label on my switchboard with the following code:
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click
'This ensures the user is the programmer needing to disable the Bypass Key
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?"
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
If strInput = "PASSWORD" Then 'just kidding, it isn't the real password
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
"The Bypass Key was disabled.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_bDisableBypassKey_Click:
Exit Sub
Err_bDisableBypassKey_Click:
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
Resume Exit_bDisableBypassKey_Click
End Sub
---------------
I have a module with the rest of the code:
Public Function SetProperties(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
I am using XP Office. I have my Library references set the same as with the
databases that this code is working correctly in, including the DAO
reference. When I double click the label and enter the password I receive
the following error; Run Time Error 3270. Property not found. I set a
breakpoint and stepped through the code and have found the code breaking on
the db.Properties(strPropName) = varPropValue. When I hover over the
breakpoint, I see where it tells me db.Properties(strPropName) = <Property
Not Found>. If I go to the first line in the function where it says Public
Function SetProperties(strPropName As String, - and hover over the
variable it tells me strPropName = "AllowByPassKey"
I sure could use some help. But for now, it's bedtime. Thanks in advance.