Home All Groups Group Topic Archive Search About

type mismatch and allowbypasskey

Author
11 Feb 2009 8:20 PM
Harvey
Hello:

I am getting a type mismatch error at

Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)

for either of the solutions at

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
http://support.microsoft.com/kb/826765#appliesto

would anyone know how to resolve this problem?

thanks
Harvey

Author
11 Feb 2009 9:59 PM
Douglas J. Steele
How have you declared prop?

You're using DAO, so you need

Dim prop As DAO.Property

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


Show quoteHide quote
"Harvey" <Har***@discussions.microsoft.com> wrote in message
news:CBDE1D4C-AAB6-4475-843D-F88CC2F7CE9E@microsoft.com...
> Hello:
>
> I am getting a type mismatch error at
>
> Set prop = db.CreateProperty("AllowByPassKey", _
> dbBoolean, False)
>
> for either of the solutions at
>
> http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
> http://support.microsoft.com/kb/826765#appliesto
>
> would anyone know how to resolve this problem?
>
> thanks
> Harvey
Are all your drivers up to date? click for free checkup

Author
12 Feb 2009 2:08 PM
Harvey
Hello Douglas:

Yes, that declaration is present in both sets of code, e.g. the MS sample
code below:


Function ap_DisableShift()
'This function disable the shift at startup. This action causes
'the Autoexec macro and Startup properties to always be executed.

On Error GoTo errDisableShift

Dim db As DAO.Database
Dim prop As Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False

'The function is successful.
Exit Function

errDisableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function




Show quoteHide quote
"Douglas J. Steele" wrote:

> How have you declared prop?
>
> You're using DAO, so you need
>
> Dim prop As DAO.Property
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Harvey" <Har***@discussions.microsoft.com> wrote in message
> news:CBDE1D4C-AAB6-4475-843D-F88CC2F7CE9E@microsoft.com...
> > Hello:
> >
> > I am getting a type mismatch error at
> >
> > Set prop = db.CreateProperty("AllowByPassKey", _
> > dbBoolean, False)
> >
> > for either of the solutions at
> >
> > http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
> > http://support.microsoft.com/kb/826765#appliesto
> >
> > would anyone know how to resolve this problem?
> >
> > thanks
> > Harvey
>
>
>
Author
12 Feb 2009 2:09 PM
Harvey
Hello Douglas:

yes, I took this code verbatim from the sample code in the links below, and
the declaration is indeed present (see code below).  any other Ideas?  I
tried various substitutions and no luck.



Function ap_DisableShift()
'This function disable the shift at startup. This action causes
'the Autoexec macro and Startup properties to always be executed.

On Error GoTo errDisableShift

Dim db As DAO.Database
Dim prop As Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False

'The function is successful.
Exit Function

errDisableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function




Show quoteHide quote
"Douglas J. Steele" wrote:

> How have you declared prop?
>
> You're using DAO, so you need
>
> Dim prop As DAO.Property
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Harvey" <Har***@discussions.microsoft.com> wrote in message
> news:CBDE1D4C-AAB6-4475-843D-F88CC2F7CE9E@microsoft.com...
> > Hello:
> >
> > I am getting a type mismatch error at
> >
> > Set prop = db.CreateProperty("AllowByPassKey", _
> > dbBoolean, False)
> >
> > for either of the solutions at
> >
> > http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
> > http://support.microsoft.com/kb/826765#appliesto
> >
> > would anyone know how to resolve this problem?
> >
> > thanks
> > Harvey
>
>
>
Author
13 Feb 2009 12:36 PM
Douglas J. Steele
Hate to say it, but the sites are wrong then.

The code you've posted says

Dim prop As Property

As I said in my original response, that needs to be

Dim prop As DAO.Property

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


Show quoteHide quote
"Harvey" <Har***@discussions.microsoft.com> wrote in message
news:EAE001E8-4256-495A-98BE-F6237091B44F@microsoft.com...
> Hello Douglas:
>
> yes, I took this code verbatim from the sample code in the links below,
> and
> the declaration is indeed present (see code below).  any other Ideas?  I
> tried various substitutions and no luck.
>
>
>
> Function ap_DisableShift()
> 'This function disable the shift at startup. This action causes
> 'the Autoexec macro and Startup properties to always be executed.
>
> On Error GoTo errDisableShift
>
> Dim db As DAO.Database
> Dim prop As Property
> Const conPropNotFound = 3270
>
> Set db = CurrentDb()
>
> 'This next line disables the shift key on startup.
> db.Properties("AllowByPassKey") = False
>
> 'The function is successful.
> Exit Function
>
> errDisableShift:
> 'The first part of this error routine creates the "AllowByPassKey
> 'property if it does not exist.
> If Err = conPropNotFound Then
> Set prop = db.CreateProperty("AllowByPassKey", _
> dbBoolean, False)
> db.Properties.Append prop
> Resume Next
> Else
> MsgBox "Function 'ap_DisableShift' did not complete successfully."
> Exit Function
>
>
>
>
> "Douglas J. Steele" wrote:
>
>> How have you declared prop?
>>
>> You're using DAO, so you need
>>
>> Dim prop As DAO.Property
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "Harvey" <Har***@discussions.microsoft.com> wrote in message
>> news:CBDE1D4C-AAB6-4475-843D-F88CC2F7CE9E@microsoft.com...
>> > Hello:
>> >
>> > I am getting a type mismatch error at
>> >
>> > Set prop = db.CreateProperty("AllowByPassKey", _
>> > dbBoolean, False)
>> >
>> > for either of the solutions at
>> >
>> > http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
>> > http://support.microsoft.com/kb/826765#appliesto
>> >
>> > would anyone know how to resolve this problem?
>> >
>> > thanks
>> > Harvey
>>
>>
>>
Author
17 Feb 2009 8:30 PM
Harvey
Right you are - problem solved.  thank you Douglas.




Show quoteHide quote
"Douglas J. Steele" wrote:

> Hate to say it, but the sites are wrong then.
>
> The code you've posted says
>
> Dim prop As Property
>
> As I said in my original response, that needs to be
>
> Dim prop As DAO.Property
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Harvey" <Har***@discussions.microsoft.com> wrote in message
> news:EAE001E8-4256-495A-98BE-F6237091B44F@microsoft.com...
> > Hello Douglas:
> >
> > yes, I took this code verbatim from the sample code in the links below,
> > and
> > the declaration is indeed present (see code below).  any other Ideas?  I
> > tried various substitutions and no luck.
> >
> >
> >
> > Function ap_DisableShift()
> > 'This function disable the shift at startup. This action causes
> > 'the Autoexec macro and Startup properties to always be executed.
> >
> > On Error GoTo errDisableShift
> >
> > Dim db As DAO.Database
> > Dim prop As Property
> > Const conPropNotFound = 3270
> >
> > Set db = CurrentDb()
> >
> > 'This next line disables the shift key on startup.
> > db.Properties("AllowByPassKey") = False
> >
> > 'The function is successful.
> > Exit Function
> >
> > errDisableShift:
> > 'The first part of this error routine creates the "AllowByPassKey
> > 'property if it does not exist.
> > If Err = conPropNotFound Then
> > Set prop = db.CreateProperty("AllowByPassKey", _
> > dbBoolean, False)
> > db.Properties.Append prop
> > Resume Next
> > Else
> > MsgBox "Function 'ap_DisableShift' did not complete successfully."
> > Exit Function
> >
> >
> >
> >
> > "Douglas J. Steele" wrote:
> >
> >> How have you declared prop?
> >>
> >> You're using DAO, so you need
> >>
> >> Dim prop As DAO.Property
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no private e-mails, please)
> >>
> >>
> >> "Harvey" <Har***@discussions.microsoft.com> wrote in message
> >> news:CBDE1D4C-AAB6-4475-843D-F88CC2F7CE9E@microsoft.com...
> >> > Hello:
> >> >
> >> > I am getting a type mismatch error at
> >> >
> >> > Set prop = db.CreateProperty("AllowByPassKey", _
> >> > dbBoolean, False)
> >> >
> >> > for either of the solutions at
> >> >
> >> > http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
> >> > http://support.microsoft.com/kb/826765#appliesto
> >> >
> >> > would anyone know how to resolve this problem?
> >> >
> >> > thanks
> >> > Harvey
> >>
> >>
> >>
>
>
>

Bookmark and Share