It's not the functional lines that are the problem, it's the error handling.
Many of the properties to which you're referring do not exist by default:
you need to explicitly create them. That's the reason why
Const conPropNotFoundError = 3270
exists in your code: in your error handling section, you have to check
whether that's the error that's raised, and create the property if it is,
rather than treating it the way you do other errors.
Take a look at this version of ChangeProperty, from
http://www.mvps.org/access/general/gen0040.htm at "The Access Web"
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(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
I haven't downloaded Albert's example, but I suspect it has similar logic in
it.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"MLH" <CRCI@NorthState.net> wrote in message
news:h27jc1hge2ei9aimv39ep4lv5ir4iunmaf@4ax.com...[color=blue]
> I'm trying, really, I am...
>
> Functional lines in yours...
> 'Set dbs = CurrentDb
> On Error GoTo Change_Err
> dbs.Properties(strPropName) = varPropValue
> ChangeProperty = True
>
> Functional lines in mine...
> 10 Set dbs = CurrentDb
> 20 On Error GoTo Change_Err
> 30 dbs.Properties(strPropName) = varPropValue
> 40 ChangeProperty = True
>
> They are too close for me. I noticed you have 4 argumentsto
> the ChangeProperty function in your code...
> Function ChangeProperty(strPropName As String, _
> varPropType As Variant, _
> varPropValue As Variant, _
> dbs As Database) 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 CraeteProperty doesn't use the DDL
> ' argument
>
> Do you think that has something to do with why my one
> property is Not Found. The others are all found.[color=green]
>>Try downloading my sample shift key by-pass setter.
>>
>>You can find it here:
>>
>>
http://www.members.shaw.ca/AlbertKal.../msaccess.html
>>
>>Note how in the above, the ChangePrpperity code is different then yours.
>>(you need to add the shiftkey property if it errors out...and it seems
>>your
>>code sample does not do that).[/color]
>[/color]