UserDefined Properties Problem



i'm trying to make a auto backup backend and i found this code from Alexey
it's called BackupSolution and can be found in here:

it works great but when it's checking if the db had a backup in the day it
creates a property to store the date
the only thing i see diferent from his sample db and mine is the permissions
in the locals window

Public Function PrpSet(dbs As Database, strPropName As String, intPropType _
As Integer, varGen As Date) As Boolean

Dim doc As Document
Dim prp As Property
Dim cnt As Container

Const conPropertyNotFound = 3270 ' Property not found error.
Set cnt = dbs.Containers!Databases ' Define Container object.

On Local Error GoTo PrpSet_Err

Set doc = cnt.Documents!UserDefined ' <-----------------
' Set custom property name. If error occurs here it means
' property doesn't exist and needs to be created and appended
' to Properties collection of Document object.
Set prp = doc.Properties(strPropName)
prp = varGen
PrpSet = True
Exit Function

If Err = conPropertyNotFound Then
Set prp = doc.CreateProperty(strPropName, intPropType, varGen)
doc.Properties.Append prp ' Append to collection.
Resume Next
ElseIf Err.Number = 3265 Then
Resume PrpSet_Bye
Else ' Unknown error.
PrpSet = False
Resume PrpSet_Bye
End If
End Function

when i compare it side by side in the sample it says:
cnt -
- AllPermissions 0
- Permissions 0
+ Documents - 4 items

but in mine it says:
cnt -
- AllPermissions 393216
- Permissions 393216
+ Documents - 1 item

also his module is called from a macro and mine from the load event in a form.

can someone help me???
thank you.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question