UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Runtime error '3270': Property Not Found    
 
   
arshad
post Mar 1 2009, 11:57 PM
Post#1



Posts: 829
Joined: 13-March 02
From: Sydney, Australia


I am getting error in the followng code I have in one of my DBs. Funny thing is that the same code in other DBs is not causing any issue. Some insights from expers will be helpful. Bold line is where I have the error. The error occurs when I click cancel on the code that sits in the class module (also shown below).
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties

'Dim db As Database, prp As Property
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 "Runtime Error # " & err.Number & vbCrLf & vbLf & err.Description
Resume Exit_SetProperties
End If

End Function
Code in Class Module
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click

Dim strInput As String
Dim strMsg As String

Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the programmer's password to enable the Bypass Key."
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")

If strInput = "nsp" Then
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup options the next time the database is opened.", vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid Password"
Exit Sub
End If

Exit_bDisableBypassKey_Click:
Exit Sub

Err_bDisableBypassKey_Click:
MsgBox "Runtime Error # " & err.Number & vbCrLf & vbLf & err.Description
Resume Exit_bDisableBypassKey_Click
End Sub
Go to the top of the page
 
vtd
post Mar 2 2009, 01:45 AM
Post#2


Retired Moderator
Posts: 19,667
Joined: 14-July 05



Have you checked the error-trapping option? We discussed this recently in UA Thread 1791194.
Go to the top of the page
 
arshad
post Mar 2 2009, 04:05 PM
Post#3



Posts: 829
Joined: 13-March 02
From: Sydney, Australia


Thanks Van. I opted for the break on unhandled errors and the error was gone. How do you define this option? Does it mean that when an error is not handled through the error trapping routine, it is ignored if you select this option? If so, then what ios the benefit of having error trapping? Secondly, why is this particular DB affected, why not others. I am little confused.
Go to the top of the page
 
vtd
post Mar 2 2009, 04:47 PM
Post#4


Retired Moderator
Posts: 19,667
Joined: 14-July 05



I explained in the earlier thread that "Break on Unhandled Errors" is the least "severe" option that uses your error-trapping code. Other options stop the code as soon as an error occurs and present the error message straight away, i.e. even before the error-trapping code has a chance to handle / manage the error.
The error-trapping option is applicable per database, not per Access installation, AFAIK.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    14th August 2018 - 02:31 PM