Runtime Error 3270

haj1503

Registered User.
Local time
Today, 23:59
Joined
Jul 1, 2003
Messages
50
Hi friends,

Ive facing this problem when I started to use this function, which the source module I found from the internet.

Once I run the module, I've received this message " Runtime Error 3270 Property not found"

Sub ExpiryDate1()
'creates or resets a property called ExpiryDate
'to use it type ExpiryDate in the debug window
'to remove the property type the following in the debug window
' DBEngine(0)(0).Properties.Delete "ExpiryDate"
On Error Resume Next
Dim db As Database
Dim p As Property
Dim pval As Date
Set db = DBEngine(0)(0)
'get the required expiry date (defaults to 30 days from now)
'NOTE: if an invalid date is entered it will generate 00:00:00
pval = CDate(InputBox("Enter the back up Date", "Set back up Date", Now() + 60))

With db
'check to see if already defined

Set p = .Properties("ExpiryDate")

If Err = 3270 Then 'property does not exist
Set p = .CreateProperty()
p.Name = "ExpiryDate"
p.Type = dbDate
p.Value = pval
.Properties.Append p
Debug.Print "Expiry Date is : "; p.Value
GoTo exit_setexpirydate
Else
Debug.Print "Expiry Date was : "; p.Value
p = pval
Debug.Print "Expiry Date is now : "; p.Value
End If

End With
exit_setexpirydate:
Set p = Nothing
Set db = Nothing
End Sub

I got message runtime error on the red mark

Please help me to solve this problem.

Best regards.
 
I don't think the Properties or CreateProperties methods work the way you think thay work, almost everything in the With DB method is actually broke, so do this..., forget about the code for a minute take a deep breath and after you exhale pull yourself back up to the keyboard and explain what you are trying to acomplish. If you publish the location of where you originally found the example may help as well.
 

Users who are viewing this thread

Back
Top Bottom