By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,627 Members | 2,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,627 IT Pros & Developers. It's quick & easy.

Property Not Found error when trying to set AllowBypassKey in A97

P: n/a
MLH
I call the following Sub and Function in frmLaunch's OnOpen
event code. I keep getting Property Not Found error for the
AllowBypassKey setting. Failure point is line #30 in the Function
(not the Sub). Ideas?

Sub SetStartupProperties()
On Error GoTo SetStartupProperties_Err
10 ChangeProperty "StartupForm", dbText, "frmLaunch" '
Form you want to open at startup
20 ChangeProperty "StartupShowDBWindow", dbBoolean, False '
True will show the dbase window
30 ChangeProperty "StartupShowStatusBar", dbBoolean, True
40 ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
50 ChangeProperty "AllowFullMenus", dbBoolean, True
60 ChangeProperty "AllowBreakIntoCode", dbBoolean, True
70 ChangeProperty "AllowSpecialKeys", dbBoolean, True
80 ChangeProperty "AllowBypassKey", dbBoolean, True '
The SHIFT key thing

SetStartupProperties_Bye:
Exit Sub

SetStartupProperties_Err:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
SetStartupProperties, CBF on frmLaunch."
k = vbNewLine & vbNewLine & Str$(Err) & ": " & """" & Error$ &
"""" & ", line #" & Erl
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume SetStartupProperties_Bye
End Sub

Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270

10 Set dbs = CurrentDb
20 On Error GoTo Change_Err
30 dbs.Properties(strPropName) = varPropValue
40 ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred setting " &
strPropName & " property in Sub ChangeProperty, CBF on frmLaunch."
k = vbNewLine & vbNewLine & Str$(Err) & ": " & """" & Error$ &
"""" & ", line #" & Erl
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume Change_Bye

End Function

Nov 13 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
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).
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #2

P: n/a
MLH
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.
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).


Nov 13 '05 #3

P: n/a
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" <CR**@NorthState.net> wrote in message
news:h2********************************@4ax.com...
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.
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).

Nov 13 '05 #4

P: n/a
MLH
Now I know why they call you guys MVP's.
That did the trick. 'preciate you setting me
straight on it. I would never have figured it
out.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It's not the functional lines that are the problem, it's the error handling.

<censored>
Nov 13 '05 #5

P: n/a
MLH
Say, if I remember correctly, there was not
a convenient way around the SHIFT bypass
in Access 2.0, was there?
Nov 13 '05 #6

P: n/a
MLH
So, now that I know about this cool new way of using
property settings to control whether database window
shows or not and whether shift bypass is allowed, should
I do away with this old way of restoring the database
window on demand?

....

DoCmd.DoMenuItem A_FORMBAR, 4, 4, 0, A_MENU_VER20

What's an up-to-date replacement procedure? Tired of living
in the past.
Nov 13 '05 #7

P: n/a
MLH <CR**@NorthState.net> wrote in
news:e4********************************@4ax.com:
Now I know why they call you guys MVP's.


Because they can read the Access help files?

Hello?

The code for setting this is found in the A97 help file under
"bypassing startup settings." The code that is there automatically
handles the property not already existing.

It would *have* to be, as that's the nature of much of Access --
Access objects are just Jet objects with a lot of "custom"
properties (from the Jet point of view). And many of the properties
are not created until the point at which a value is set for them.

You can easily see this demonstrated by cycling through the
properties of any Access object. You'll see that the number of
existing properties in the properties collection is fewer than the
number of properties listed on the object's corresponding properties
sheet. That's because, until you *set* many of those property in the
property sheet (or through code), the property does not yet exist.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8

P: n/a
MLH <CR**@NorthState.net> wrote in
news:2e********************************@4ax.com:
So, now that I know about this cool new way of using
property settings to control whether database window
shows or not and whether shift bypass is allowed, should
I do away with this old way of restoring the database
window on demand?

...

DoCmd.DoMenuItem A_FORMBAR, 4, 4, 0, A_MENU_VER20

What's an up-to-date replacement procedure? Tired of living
in the past.


Look at the help for DoCmd.SelectObject.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9

P: n/a
MLH <CR**@NorthState.net> wrote in
news:2e********************************@4ax.com:
So, now that I know about this cool new way of using
property settings to control whether database window
shows or not and whether shift bypass is allowed, should
I do away with this old way of restoring the database
window on demand?

...

DoCmd.DoMenuItem A_FORMBAR, 4, 4, 0, A_MENU_VER20

What's an up-to-date replacement procedure? Tired of living
in the past.


BTW, I'd highly recommend that you spend a lot of time navigating
the help files. I'm not sure which version you're developing in, but
if it's A97, you've got the best set of help files for Access that
Microsoft ever produced.

You will learn a lot by familiarizing yourself with their structure
and terminology.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #10

P: n/a

"David W. Fenton" <dX********@bway.net.invalid> wrote
BTW, I'd highly recommend that you
spend a lot of time navigating the help
files. I'm not sure which version you're
developing in, but if it's A97, you've
got the best set of help files for Access
that Microsoft ever produced.


I keep a copy of Access 97 on my development machine, as much for the Help
files as for any other reason. On the other hand, depending on your
criteria, Access 2.0's Help files may be more complete. They contained, I
heard, every item that was in the manuals.

Perhaps Access 97's manuals were more complete (if you purchased them, which
you didn't have to do with Access 2.0 -- they came with the product) so
there could be as much in Help without including every item. Still, I never
heard that Access 97 Help included everything that was in the manuals.

As important as content is, the user interface to WinHelp was so much better
than HTML Help (aka The Abominable Helpman), and the current
Online-is-Primary HTML Help that I miss it just as much as the content.

If I were an odds-maker, I'd give a change back to something closely
resembling WinHelp odds only slightly less than those of a snowball
surviving The Hottest Place. <SIGH> That's my opinion, not a violation of
any NDA.

Larry Linson
Microsoft Access MVP

Nov 13 '05 #11

P: n/a
MLH
You mean its as simple as DoCmd.SelectObject acForm, "Form1", True
!!! I never thought about that. I'll bet that would have worked in
Access 2.0 as well. I tried it and like it much better. Are there any
situations in which it might not result in unhiding the database
window?

All I needed was a point in the right direction here. Thx David.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx

Look at the help for DoCmd.SelectObject.


Nov 13 '05 #12

P: n/a
MLH
I agree with you. In fact, I do spend a lot of time in A97 help. I
couldn't survive without it. I am in A97 and, now that I have
sharpened my skills using it, I really do like it.

Thx again.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

BTW, I'd highly recommend that you spend a lot of time navigating
the help files. I'm not sure which version you're developing in, but
if it's A97, you've got the best set of help files for Access that
Microsoft ever produced.

You will learn a lot by familiarizing yourself with their structure
and terminology.


Nov 13 '05 #13

P: n/a
MLH
Big Oops...
That's not gonna work for me.
It actually opens the form. If there
was a command that selected the
object w/o opening it - that would
work.
Nov 13 '05 #14

P: n/a
MLH <CR**@NorthState.net> wrote in
news:5g********************************@4ax.com:
Big Oops...
That's not gonna work for me.
It actually opens the form. If there
was a command that selected the
object w/o opening it - that would
work.


What? When I do it, it doesn't open the form -- it just reveals the
database window with the form selected.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #15

P: n/a
"Larry Linson" <bo*****@localhost.not> wrote in
news:bNmye.22802$Fn4.10657@trnddc06:

"David W. Fenton" <dX********@bway.net.invalid> wrote
BTW, I'd highly recommend that you
spend a lot of time navigating the help
files. I'm not sure which version you're
developing in, but if it's A97, you've
got the best set of help files for Access
that Microsoft ever produced.
I keep a copy of Access 97 on my development machine, as much for
the Help files as for any other reason. On the other hand,
depending on your criteria, Access 2.0's Help files may be more
complete. They contained, I heard, every item that was in the
manuals.

Perhaps Access 97's manuals were more complete (if you purchased
them, which you didn't have to do with Access 2.0 -- they came
with the product) so there could be as much in Help without
including every item. Still, I never heard that Access 97 Help
included everything that was in the manuals.


I don't know that I give a rat's ass if the help files duplicate the
manuals.

What I care about is that the help files are organized in a manner
that allows me to find the information I need, and A97's were vastly
improved over Access 2's.
As important as content is, the user interface to WinHelp was so
much better than HTML Help (aka The Abominable Helpman), and the
current Online-is-Primary HTML Help that I miss it just as much as
the content.
The think that drives me craziest is the autocratic nature of the
window sizing. I despise an application that will not let me set the
size of the window, and that won't honor those settings. You'll note
that HTML Help doesn't even have a standard Windows title bar, and
can't be vertically resized. It also has no options to allow you to
control the way it works.

It is the absolute worst example of a Microsoft-designed user
interface I've ever seen.
If I were an odds-maker, I'd give a change back to something
closely resembling WinHelp odds only slightly less than those of a
snowball surviving The Hottest Place. <SIGH> That's my opinion,
not a violation of any NDA.


As MichKa said, the Help team at Microsoft had to get Internet-ized
somehow, so that's how they did it.

The crazy part of it is that HTML is a natural format for
distributing help files, but MS couldn't just use plain old HTML --
it had to be compiled in a special way to give some kind of extra
features. From my point of view, they took out features for finding
information.

What a disaster!

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #16

P: n/a
Hey, David.
You'll note
that HTML Help doesn't even have a standard Windows title bar, and
can't be vertically resized. It also has no options to allow you to
control the way it works.


The default location for help is docked on the right side of the
screen. Try dragging it to the middle of the screen so that it floats.
After that you may find that it behaves more like a regular window.
Cheers,
Gord

Nov 13 '05 #17

P: n/a
"Gord" <gd*@kingston.net> wrote in
news:11*********************@g43g2000cwa.googlegro ups.com:

[I wrote:]
You'll note
that HTML Help doesn't even have a standard Windows title bar, and
can't be vertically resized. It also has no options to allow you
to control the way it works.


The default location for help is docked on the right side of the
screen. Try dragging it to the middle of the screen so that it
floats. After that you may find that it behaves more like a
regular window.


Well, that's good to know, but it doesn't change the fact that MS
chose a really badly-designed, autocratic default UI that lacks the
discoverability that would lead users to figure out how to control
the window on their own. Lacking a proper title bar, I never would
have thought to try to grab and drag the window using a different
part of it.

I'm glad to see that HTML Help retains my settings, so now I can use
it without hating every minute of it.

Now if I could only get the VBE window to open as a child of the
Access window...

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #18

P: n/a
MLH
Now that's strange. I wonder why it opens the form on mine but not
yours? Is your database window hidden at the time of running the
procedure? I don't know if that would make a difference or not.

What? When I do it, it doesn't open the form -- it just reveals the
database window with the form selected.


Nov 13 '05 #19

P: n/a
MLH <CR**@NorthState.net> wrote in
news:pb********************************@4ax.com:
What? When I do it, it doesn't open the form -- it just reveals
the database window with the form selected.


Now that's strange. I wonder why it opens the form on mine but not
yours? Is your database window hidden at the time of running the
procedure? I don't know if that would make a difference or not.


It doesn't matter one way or the other -- if it's hidden, it reveals
it. If it's not hidden (maximized, minimized of "mediumized"), it
just brings it to the front with the requested form selected.

Try doing it with something other than a form.

Are you certain you don't have SendKeys in there somewhere with a
stray carriage return being passed through?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.