Group: microsoft.public.access
From: =?Utf-8?B?Z2VybWFpbkh1YmVyZGVhdQ==?=
Date: Saturday, October 13, 2007 9:49 AM
Subject: Re: AllowByPassKey

Thanks for your reply.

I also had previously tried the Dim dbs As DAO.Database, prp As DAO.Property
( I had to add the reference MS 3.6 object in the library.)

I tried many variation of solutions from different programmers with
basically the same coding. I stepped through the code everytime to see where
it err's and for all of them I get the same error on the following code
statements:

dbs.Properties(strPropName) = varPropValue
and
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)

"Douglas J. Steele" wrote:

> Not sure whether this is the problem, but your declaration should be
>
> Dim dbs As DAO.Database, prp As DAO.Property
>
> If that doesn't solve the problem, try single-stepping through the code to
> identify the exact line that's raising the error.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "germainHuberdeau" wrote in
> message news:00C6A367-7634-4CEF-B940-5E2E19BCF05B@microsoft.com...
> > When I try to execute the AllowBypassKey function further below I get the
> > following error
> >
> > => object variable or with block variable not set
> >
> > Sub SetBypassProperty()
> > Const DB_Boolean As Long = 1
> > ChangeProperty "AllowBypassKey", DB_Boolean, False
> > End Sub
> >
> > Function ChangeProperty(strPropName As String, _
> > varPropType As Variant, _
> > varPropValue As Variant) As Integer
> >
> > Dim dbs As Object, prp As Variant
> > 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
> >
>
>
>

Safety Articles | News in English | 20lbs in 30 days | Bluegrass | Usenet Newsfeeds