Need Entry Point 18 Help On Access Executable File

J

Jeff Conrad

Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some Access 97
wizard code and trying to make it compatible with 2000, 2002, and 2003. The
97 code references entry point 18 for something which cannot be found in the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long, pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make some
code to get a list of all the macros as well as one to get a count, but my
problem is getting this to work *within* the confines of the other existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees something
obvious I'd be most interested in hearing your thoughts. I can point you to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,
 
M

M.L. Sco Scofield

Happy belated b'day Jeff.

Don't you ever sleep?

Last piece? Sure...

I just made copies of all of the "viewable" code and am taking them home.

I'm walking out the door for the rest of the weekend and won't be back until
Tuesday morning.

I'll take a look at it when I get board watching TV, making some updates to
my web site, and working on a couple of new ASP pages this weekend.

If someone doesn't get back to you sooner, I should have something for you
on Tuesday. Maybe.

Go to bed.

Have a safe 4th.

Later...

Sco
 
F

Fred Boer

Haven't got a cluewhat the heck you are talking about, but I hope you (and
all your fellow Americans...) have a great 4th of July!

Fred
 
J

Jeff Conrad

"M.L. Sco Scofield" <[email protected]>

Hi Sco,
Happy belated b'day Jeff.
Thanks.

Don't you ever sleep?

Yes, but remember I'm a couple of hours behind you so it wasn't too late.
Now if I look at your posted time, who is the one not sleeping?
Last piece? Sure...

Trust me, it is. I'm 99% sure. Everything else seems to be just fine under
2000, 2002, and 2003. Naturally I was quite disappointed by discovering this
problem since everything else was just clicking away.
:-(
If there is one thing I'm good at, it's testing things!
I just made copies of all of the "viewable" code and am taking them home.

The only one you actually need is the Wzmain80.mde file found here:

http://support.microsoft.com/?id=151196

Here are the things to look for:
1. Look in the wlib_Util2 module for the entry point 18 reference in the
Declarations area.

2. Then find the function called wlib_CGetExecutableMacros in the same
module. Put a breakpoint right at the beginning of this function. This is
the ONLY spot this entry point is used.

3. The function gets called from the following form:
sbm_frmEditSbItem
It only happens when you select "Run Macro" from the Command combo box. The
Argument combo box will then fill with a list of all macro names. If you
step through the code it goes all over the place! So the trouble I'm having
is devising a custom function that will do the same thing, but within the
confines of all the over stuff going on! If I can get this to work under
Access 2000, 2002, and 2003 then the project will be finally finished.
I'm walking out the door for the rest of the weekend and won't be back
until Tuesday morning.
I'll take a look at it when I get bored watching TV, making some updates to
my web site, and working on a couple of new ASP pages this weekend.
If someone doesn't get back to you sooner, I should have something for you
on Tuesday. Maybe.

No problem, I would be most gracious for any help you could provide.
Go to bed.

Yes, Dad.
;-)
Have a safe 4th.

Thanks, you too.
 
T

Terry Kreft

Jeff,
I think that all your interested in from the point of view of this function
is that it returns a count of macros.

You can get this in a number of ways such as
currentdb.Containers("scripts").Documents.Count

or running a query against MSysObjects (Select count * from MsysObjects
Where type = -32766)

There is a slight problem in that when objects are deleted their
documents.count doesn't refresh properly nor does MsysObjects drop it's
record until the database is closed and reopened, but then all this means is
that the combo may have a blank line or two at the bottom.
 
M

M.L. Sco Scofield

Inline...

Sco

Jeff Conrad said:
"M.L. Sco Scofield" <[email protected]>

Hi Sco,


Yes, but remember I'm a couple of hours behind you so it wasn't too late.

Where are you?
Now if I look at your posted time, who is the one not sleeping?
<g>

I'm noctornal. It was the middle of my day. :)
Trust me, it is. I'm 99% sure. Everything else seems to be just fine under
2000, 2002, and 2003. Naturally I was quite disappointed by discovering this
problem since everything else was just clicking away.
:-(

Well, I found the 1%. :)
If there is one thing I'm good at, it's testing things!

Good!
home.

The only one you actually need is the Wzmain80.mde file found here:

I knew that. After I got them all home.
http://support.microsoft.com/?id=151196

Here are the things to look for:
1. Look in the wlib_Util2 module for the entry point 18 reference in the
Declarations area.

2. Then find the function called wlib_CGetExecutableMacros in the same
module. Put a breakpoint right at the beginning of this function. This is
the ONLY spot this entry point is used.

Yup.


3. The function gets called from the following form:
sbm_frmEditSbItem
It only happens when you select "Run Macro" from the Command combo box. The
Argument combo box will then fill with a list of all macro names.

Yup.


If you
step through the code it goes all over the place!

Not really. :) It only went 3 or 4 routines deep. I write stuff that goes
deeper than that.
So the trouble I'm having
is devising a custom function that will do the same thing, but within the
confines of all the over stuff going on! If I can get this to work under
Access 2000, 2002, and 2003 then the project will be finally finished.

Details in another posting.
until Tuesday morning.



No problem, I would be most gracious for any help you could provide.

Wait until you read my novel. :)
Yes, Dad.
;-)

LOL!


Thanks, you too.

Thanks. I did.
<snip>
 
M

M.L. Sco Scofield

Thank you Fred.

Sco

Fred Boer said:
Haven't got a cluewhat the heck you are talking about, but I hope you (and
all your fellow Americans...) have a great 4th of July!

Fred
<snip>
 
M

M.L. Sco Scofield

Inline...

Sco

Terry Kreft said:
Jeff,
I think that all your interested in from the point of view of this function
is that it returns a count of macros.

Sorry Terry. It actually does much more. For the details, see the novel I
posted back to Jeff.
You can get this in a number of ways such as
currentdb.Containers("scripts").Documents.Count

or running a query against MSysObjects (Select count * from MsysObjects
Where type = -32766)

There is a slight problem in that when objects are deleted their
documents.count doesn't refresh properly nor does MsysObjects drop it's
record until the database is closed and reopened, but then all this means is
that the combo may have a blank line or two at the bottom.
<snip>
 
M

M.L. Sco Scofield

Jeff,

Below is the "novel" that I wrote over the weekend before I saw your post to
me on the 4th.

You already know some of the things I described, but for time's sake, I'm
leaving it the way I wrote it.

I wish you were closer. I think sitting in one of my VBA classes might help
you hone your tracing skills. :)

Sco

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jeff,

Are you sure #18 is the last one? :)

wlib_CGetExecutableMacros (and routines it calls,) also uses:

#20 - wlib_CloseHscr
#22 - wlib_FNextHscr
#23 - wlib_FGetStringHscrIscc

Before I get started, I just want to say that Me.InstructorMode = True. :)
From your posts I get the feeling that you are very versed in a lot of
areas, however, a couple of comments you have made makes me also believe
that you have a few deep holes scattered about. Not knowing exactly where
those holes are, I may over explain a few things. I mean no offense. Just
playing teacher. :) With that said...

What they mean by "excitable macros" is not "executable" vs.
"non-executable." They are referring to all of the individual, "named"
macros inside of a macro group which are also executable.

wlib_CGetExecutableMacros not only gets all of the macro object names, which
could be groups, but also all of the named macros inside of any groups.

It is used in places like the switchboard manager. When you select Run Macro
from the Command dropdown, the Macro dropdown lists "all" executable macros,
not just the macro object names you see in the database container. (Just
like the list in the dropdown for an event in the property box.)

Getting a list of all of the macro objects, which could be groups, is easy.
Getting the internal names is the trick and this is what all of this code is
all about.

You are correct that wlib_CGetExecutableMacros returns the number of macros.
But not just the number of macro objects you see in the database container.
It is the number of all of the "executable" macros.

Part of the magic of wlib_CGetExecutableMacros is that only one of its two
arguments, the database, is a "normal" input argument. The second argument
is actually used for output. One of the two ways an argument can be passed,
(the default,) is by reference. The second argument needs to be a reference
to a dynamic string array. wlib_CGetExecutableMacros loads up the array with
all of the "executable" macro names.

Here's a little piece of code that puts wlib_CGetExecutableMacros through
its paces. To see what it does, make sure that you have at least one macro
with at least one internal name.

<CodeSample>
Sub TestGetMacroNames()

Dim db As DAO.Database
Dim astrMacronames() As String
Dim intCount As Integer
Dim intLoop As Integer

Set db = CurrentDb

intCount = wlib_CGetExecutableMacros(db, astrMacronames())

Debug.Print intCount

For intLoop = LBound(astrMacronames()) To intCount
Debug.Print astrMacronames(intLoop)
Next

Set db = Nothing

End Sub
</CodeSample>

So that's what wlib_CGetExecutableMacros does. It gets all of the
"executable" macro names loaded into a string array and it returns how many
there are.

What do all of the Access API calls do? Here are my best guesses:

#18 - wlib_HscrOpenEx
Loads a macro specified by name into memory (without executing it) and
returns a 32 bit "handle"

#20 - wlib_CloseHscr
Unloads a loaded macro specified by a handle from memory

#22 - wlib_FNextHscr
Gets a handle to a line in a macro

#23 - wlib_FGetStringHscrIscc
Gets the text from the name column of the macro line specified by a handle

To help understand how some of this code works, you need to understand a
little bit of "API calls 101." The APIs are written in C++ and it is very
common in C++ (and C and assembler) to return information in what VBA people
would normally think of as input parameters. Because arguments can be passed
by reference, the procedure code can change the value of the arguments and
the calling code can see the new values. (Be aware that when passing
references to strings between VBA and C++, the ByValue keyword is actually
used, but that's a topic for another day. :)

This is what is happening between wlib_FNextHscr and wlib_StOfHscrIscc.
wlib_FNextHscr is getting a handle and putting it in hscr and then
wlib_StOfHscrIscc is using the handle already loaded in hscr. This is also
how wlib_CGetExecutableMacros is returning the array with all of the names.

If you single step my code and examine the variables as it calls the various
procedures, you should start to get a feel for what is going on.

Now, with all of that said, as you already mentioned, it is easy to get the
macro object names. The tricky part is getting the internal names in a
group. I did a "quick" search and didn't find any easy way. But hey, this is
your project. (Which, by the way, you won't tell any of us what it does.)

To help you with your research, be aware that some of the folks at MS call
Access macros scripts. This is why you see "scr" in the API names. (Hscr in
the names means "script handle.")

So, until you hit some more brick walls, you're on your own again! :)

Sco
 
J

Jeff Conrad

Hi Sco,
Where are you?

Hummm.....I sort of assumed my sig gave it away.
;-)
Well, I found the 1%. :)

I was afraid of something like this.
I knew that. After I got them all home.

Sorry, I probably should have mentioned that first.
Not really. :) It only went 3 or 4 routines deep. I write stuff that goes deeper than that.

And this is why you're on one side of the desk and I'm on the other.
Wait until you read my novel. :)

Any thoughts do help, trust me.
 
J

Jeff Conrad

Hi Terry, your expertise is most welcome.
I think that all your interested in from the point of view of this function
is that it returns a count of macros.

That's what I was thinking.
You can get this in a number of ways such as
currentdb.Containers("scripts").Documents.Count

I'm experimenting with that right now.
or running a query against MSysObjects (Select count * from MsysObjects
Where type = -32766)

Testing that as well.
Both of these *may* just work in my situation.
There is a slight problem in that when objects are deleted their
documents.count doesn't refresh properly nor does MsysObjects drop it's
record until the database is closed and reopened, but then all this means is
that the combo may have a blank line or two at the bottom.

I don't think this will be too much of a problem in my case, but that is good to know.
I have lots of things to test now so this should keep me busy for sure.
I will post back with the results.

Thanks, Terry!
 
M

M.L. Sco Scofield

Sig? Dah. Brain dead is all I can say.

Some day I gots ta learn how to read...
 
J

Jeff Conrad

Hi Sco,
Below is the "novel" that I wrote over the weekend before I saw your post to
me on the 4th.

Excellent, thanks.
You already know some of the things I described, but for time's sake, I'm
leaving it the way I wrote it.

I wish you were closer. I think sitting in one of my VBA classes might help
you hone your tracing skills. :)

I would definitely be in the front row!
Are you sure #18 is the last one? :)

Not anymore apparently!
:-(
wlib_CGetExecutableMacros (and routines it calls,) also uses:

#20 - wlib_CloseHscr
#22 - wlib_FNextHscr
#23 - wlib_FGetStringHscrIscc
Before I get started, I just want to say that Me.InstructorMode = True. :)

Me.BigSponge = True as well
From your posts I get the feeling that you are very versed in a lot of areas,

I suppose it all depends upon your point of view. The old saying, "The more I know about Access, the
more I don't know" certainly applies in my case. I'm self-taught in Access with a couple of books as
a resource. A tremendous amount of my knowledge has come from these NGs and the incredible help the
MVPs and non-MVPs provide. I learn a lot by just getting in and trying something. I've done lots of
different things with Access; many serious things and some not so serious stuff. But, I learn
something every time I experiment. I've made an Access "Game" program before which a few people
have. Seems silly, but I learned a lot. Now if you'd like to see some slick calendar style reports,
I have quite a few! :)
however, a couple of comments you have made makes me also believe
that you have a few deep holes scattered about.

I would have used the word chasm, but OK, we'll go with "holes."
Not knowing exactly where those holes are, I may over explain a few things.
I mean no offense. Just playing teacher. :) With that said...

Don't EVER fear talking down to me or over explaining things!
What they mean by "excitable macros" is not "executable" vs.
"non-executable." They are referring to all of the individual, "named"
macros inside of a macro group which are also executable.

Massive chasm for me with macros.
The ONLY time I ever use a macro is for an AutoExec.
I want to use VBA with proper error handling.
So my experience with them IsNull. said:
wlib_CGetExecutableMacros not only gets all of the macro object names, which
could be groups, but also all of the named macros inside of any groups.

I'm still a little confused.
What is a "macro group?"
So are you saying you could have a macro named Macro1 and inside that macro there are several
*other* macros? Each of these "other" macros listed in Macro1 would be listed in the combo box?
It is used in places like the switchboard manager. When you select Run Macro
from the Command dropdown, the Macro dropdown lists "all" executable macros,
not just the macro object names you see in the database container. (Just
like the list in the dropdown for an event in the property box.)

I see.....I think.
Just still hazy on the macro group thing.
Getting a list of all of the macro objects, which could be groups, is easy.
Getting the internal names is the trick and this is what all of this code is
all about.
You are correct that wlib_CGetExecutableMacros returns the number of macros.
But not just the number of macro objects you see in the database container.
It is the number of all of the "executable" macros.

Part of the magic of wlib_CGetExecutableMacros is that only one of its two
arguments, the database, is a "normal" input argument. The second argument
is actually used for output. One of the two ways an argument can be passed,
(the default,) is by reference. The second argument needs to be a reference
to a dynamic string array. wlib_CGetExecutableMacros loads up the array with
all of the "executable" macro names.

I think I follow you on this.
Here's a little piece of code that puts wlib_CGetExecutableMacros through
its paces. To see what it does, make sure that you have at least one macro
with at least one internal name.

<CodeSample>
Sub TestGetMacroNames()

Dim db As DAO.Database
Dim astrMacronames() As String
Dim intCount As Integer
Dim intLoop As Integer

Set db = CurrentDb

intCount = wlib_CGetExecutableMacros(db, astrMacronames())

Debug.Print intCount

For intLoop = LBound(astrMacronames()) To intCount
Debug.Print astrMacronames(intLoop)
Next

Set db = Nothing

End Sub
</CodeSample>
So that's what wlib_CGetExecutableMacros does. It gets all of the
"executable" macro names loaded into a string array and it returns how many
there are.

Ahh well that code does help actually!
One of the problems I was having was trying to see how the names of the objects are returned to the
combo box from this function, but your code sample REALLY helps me see what is happening.
What do all of the Access API calls do? Here are my best guesses:

#18 - wlib_HscrOpenEx
Loads a macro specified by name into memory (without executing it) and
returns a 32 bit "handle"

#20 - wlib_CloseHscr
Unloads a loaded macro specified by a handle from memory

#22 - wlib_FNextHscr
Gets a handle to a line in a macro

#23 - wlib_FGetStringHscrIscc
Gets the text from the name column of the macro line specified by a handle

Yikes!
The house of cards keeps tumbling down doesn't it?
I honestly did not do that much digging, maybe I should have checked more carefully.
To help understand how some of this code works, you need to understand a
little bit of "API calls 101." The APIs are written in C++ and it is very
common in C++ (and C and assembler) to return information in what VBA people
would normally think of as input parameters. Because arguments can be passed
by reference, the procedure code can change the value of the arguments and
the calling code can see the new values. (Be aware that when passing
references to strings between VBA and C++, the ByValue keyword is actually
used, but that's a topic for another day. :)

This is what is happening between wlib_FNextHscr and wlib_StOfHscrIscc.
wlib_FNextHscr is getting a handle and putting it in hscr and then
wlib_StOfHscrIscc is using the handle already loaded in hscr. This is also
how wlib_CGetExecutableMacros is returning the array with all of the names.

If you single step my code and examine the variables as it calls the various
procedures, you should start to get a feel for what is going on.

Thanks, this certainly helps my understanding of the whole process.
Now, with all of that said, as you already mentioned, it is easy to get the
macro object names. The tricky part is getting the internal names in a
group. I did a "quick" search and didn't find any easy way. But hey, this is
your project. (Which, by the way, you won't tell any of us what it does.)

Well I suppose it would seem pretty obvious by now what I'm working on.
It may also help the process of finding a solution as well.

I've created an Advanced Switchboard Manager Add-In.
I'm sure all the MVPs and experts will look at it as a complete waste of time and would rather spit
on it. I know the experts hate the Switchboard wizard with a passion because of its limitations, but
this is for the beginners and intermediates out there. The Switchboard wizard is obviously used by
many, many people judging by the number of questions that appear in the NGs weekly (and even daily).
And it's always the same questions: "How can I have more than 8 items?", "How do I open a form in
datasheet mode?", "How do I open a query from the Switchboard?", "How do I close the database and
Access?", etc, etc.

My Advanced Switchboard Manager benefits:

1. Up to sixteen items allowed per page (although personally I think this is exceedingly excessive!)
More could be added, but you'd have to add them manually to the table.

2. You can open a datasheet form in Add mode or Edit mode right from the options list without having
to manually change the Switchboard form code.

3. You can open a query right from the Switchboard.

4. I have one option to just close the database and another to close the database AND Access all
together.

5. Another option will print a report directly to the printer instead of previewing it first.

And it is the same interface that current user's are familiar with. Nothing new to learn.

This would be my gift to the NG community and it could be posted somewhere for download if anyone
wants to use it. (I do not have my own web site) It could be on the Access Web possibly (always been
a dream of mine to have something posted there).<g>

For me this was a new area of Access development. Along the way I've learned how to create a form
and controls in code, paste code into a new form module, the inner workings of some of the Access
wizards, as well as how to create an Add-In and what requirements are needed. I've enjoyed the
experience.

Right now I'm also making a special surprise for one of the MVPs while I'm learning another new area
of Access.
To help you with your research, be aware that some of the folks at MS call
Access macros scripts. This is why you see "scr" in the API names. (Hscr in
the names means "script handle.")

Good to know.
So, until you hit some more brick walls, you're on your own again! :)

Believe it or not you've helped IMMENSELY!
I have some ideas and have been testing for only a few minutes, but I think I may be on to something
now! I will post back with my results.

Thank you very much Sco!
 
M

M.L. Sco Scofield

Jeff,

Did you get the email I sent you yesterday with the link to the sample
macro?

Sco

Jeff Conrad said:
Hi Sco,


Excellent, thanks.


I would definitely be in the front row!


Not anymore apparently!
:-(

:)

Me.BigSponge = True as well
areas,

I suppose it all depends upon your point of view. The old saying, "The more I know about Access, the
more I don't know" certainly applies in my case. I'm self-taught in Access with a couple of books as
a resource. A tremendous amount of my knowledge has come from these NGs and the incredible help the
MVPs and non-MVPs provide. I learn a lot by just getting in and trying something. I've done lots of
different things with Access; many serious things and some not so serious stuff. But, I learn
something every time I experiment. I've made an Access "Game" program before which a few people
have. Seems silly, but I learned a lot. Now if you'd like to see some slick calendar style reports,
I have quite a few! :)


I would have used the word chasm, but OK, we'll go with "holes."


Don't EVER fear talking down to me or over explaining things!


Massive chasm for me with macros.
The ONLY time I ever use a macro is for an AutoExec.
I want to use VBA with proper error handling.


I'm still a little confused.
What is a "macro group?"
So are you saying you could have a macro named Macro1 and inside that macro there are several
*other* macros? Each of these "other" macros listed in Macro1 would be listed in the combo box?


I see.....I think.
Just still hazy on the macro group thing.



I think I follow you on this.



Ahh well that code does help actually!
One of the problems I was having was trying to see how the names of the objects are returned to the
combo box from this function, but your code sample REALLY helps me see what is happening.
handle

Yikes!
The house of cards keeps tumbling down doesn't it?
I honestly did not do that much digging, maybe I should have checked more carefully.

Thanks, this certainly helps my understanding of the whole process.
does.)

Well I suppose it would seem pretty obvious by now what I'm working on.
It may also help the process of finding a solution as well.

I've created an Advanced Switchboard Manager Add-In.
I'm sure all the MVPs and experts will look at it as a complete waste of time and would rather spit
on it. I know the experts hate the Switchboard wizard with a passion
because of its limitations, but
 
J

Jeff Conrad

M.L. Sco Scofield said:
Jeff,

Did you get the email I sent you yesterday with the link to the sample macro?

Sco

No, I'm sorry I did not receive the file.
Posted e-mail address to the NG is invalid to keep the SPAM down.
My apologies for the confusion, I did not realize an offline message was being sent.
I just sent a message to the webmaster address at your site with my e-mail address.

I'm very interested to see the sample macro file.
Thank you very much!

--
Jeff Conrad
Access Junkie
Bend, Oregon

<snip>
 
J

Jeff Conrad

Hi Sco,

Thanks for the sample file illustrating what a macro group looks like.
It now makes perfect sense to me.

The form events as well as the Switchboard Manager combo box do list the macro objects shown in the
Database Window as well as any macro groups. This really helped me visualize the difference.

I thought I was on to something by changing the code on the form sbm_frmEditSbItem from this:

Case CMD_RUNMACRO
cst = wlib_CGetExecutableMacros(wlib_dbCur, rgst())

to this:

Case CMD_RUNMACRO
cst = wlib_GetObjList(wlib_dbCur, acMacro, rgst(), &HFFFFF)

No errors at all on the later Access versions.

When I ran my advanced add-in, however, sure enough only the macro listed in the Database Window was
displayed. Darn!! I think I may just have to live with this restriction since it would seem to be
extremely difficult to duplicate the functionality of the entry points referenced throughout the
code.
:-(
So close.
 
M

M.L. Sco Scofield

Jeff,

Inline...

Sco

Jeff Conrad said:
Hi Sco,


Excellent, thanks.



You’re welcome.


I would definitely be in the front row!



Then get yourself to Denver! :)


Not anymore apparently!
:-(



In my best Maxwell Smart voice, "Sorry about that…"


:)

Me.BigSponge = True as well



:)



areas,

I suppose it all depends upon your point of view. The old saying, "The more I know about Access, the
more I don't know" certainly applies in my case. I'm self-taught in Access with a couple of books as
a resource. A tremendous amount of my knowledge has come from these NGs and the incredible help the
MVPs and non-MVPs provide. I learn a lot by just getting in and trying something. I've done lots of
different things with Access; many serious things and some not so serious stuff. But, I learn
something every time I experiment. I've made an Access "Game" program before which a few people
have. Seems silly, but I learned a lot. Now if you'd like to see some slick calendar style reports,
I have quite a few! :)



We each get there our own way. The important thing is to *keep* learning.


I would have used the word chasm, but OK, we'll go with "holes."



:)





Don't EVER fear talking down to me or over explaining things!



Thanks. Some people get a little thin skinned around here sometimes.


Massive chasm for me with macros.
The ONLY time I ever use a macro is for an AutoExec.
I want to use VBA with proper error handling.
So my experience with them IsNull. <g>



Although some will disagree with me, I firmly believe there are a multitude
of reasons to understand them. Just try and write a fully functional app
without using DoCmd. A lot of programmers refuse to acknowledge that it’s an
object to execute *macro actions* in VBA. And although you never need to use
AutoExec any more, just try and get by without AutoKeys.


I'm still a little confused.
What is a "macro group?"
So are you saying you could have a macro named Macro1 and inside that macro there are several
*other* macros? Each of these "other" macros listed in Macro1 would be
listed in the combo box?



Short answer because you’ve already looked at the sample I made for you.



Yes.


I see.....I think.
Just still hazy on the macro group thing.



Not any more! :)


I think I follow you on this.



Time…






Ahh well that code does help actually!
One of the problems I was having was trying to see how the names of the objects are returned to the
combo box from this function, but your code sample REALLY helps me see
what is happening.



Thank you. The words every instructor longs to here. I couldn’t ask for
more! :)


handle

Yikes!
The house of cards keeps tumbling down doesn't it?
I honestly did not do that much digging, maybe I should have checked more carefully.



One word. Trace! :)



And as you could see from my sample, sometimes you have to write a little
code to be able to test other code properly.


Thanks, this certainly helps my understanding of the whole process.



You’re welcome. Glad to have been of help.


does.)

Well I suppose it would seem pretty obvious by now what I'm working on.
It may also help the process of finding a solution as well.



I suspected. :)


I've created an Advanced Switchboard Manager Add-In.



Cool. I’ve always thought it needed some updates. Never took the time.


I'm sure all the MVPs and experts will look at it as a complete waste of time and would rather spit
on it. I know the experts hate the Switchboard wizard with a passion because of its limitations,



Yes, there are those. Everyone seems to have there own “best” switchboard.
If any of us looked closely at a "Windows" program, we probably would be
using them. Ever see a switchboard in Word, Excel, PowerPoint, Internet
Explorer, or NotePad? It’s all done with menus and toolbars. Almost all of
the VB programs I’ve written over the years only use menus and toolbars for
navigation.


but
this is for the beginners and intermediates out there. The Switchboard wizard is obviously used by
many, many people judging by the number of questions that appear in the
NGs weekly (and even daily).



Yes it is. I even cover it in one of the classes I teach. Although nothing
functional, we do make some cosmetic changes so it doesn’t look quite so bad
..


And it's always the same questions: "How can I have more than 8 items?", "How do I open a form in
datasheet mode?", "How do I open a query from the Switchboard?", "How do I close the database and
Access?", etc, etc.

My Advanced Switchboard Manager benefits:

1. Up to sixteen items allowed per page (although personally I think this is exceedingly excessive!)
More could be added, but you'd have to add them manually to the table.



Too many. Studies have show most people get overwhelmed with more than 5 or
6 choices. Why do you think there are cascading menus? And those pesky
delayed, auto expanding menus?



I’ve bumped mine up to 12. Not so much to add items but to be able to put a
gap between the last item and the previous menu or exit app buttons.



Have you seen the switchboard in one of the downloadable templates? They put
exit as a separate button at the bottom. Extra button separated from the
last item I like. Available on every sub switchboard I don’t.


2. You can open a datasheet form in Add mode or Edit mode right from the options list without having
to manually change the Switchboard form code.



Comment below regarding need.


3. You can open a query right from the Switchboard.



Noooo! Part of an app is *no* table and query datasheets. If you must
datasheet, it should be with a form. This is #2 of the Access Ten
Commandments, http://www.mvps.org/access/tencommandments.htm, which in
addition to saying tables, should also include queries.


4. I have one option to just close the database



In an "app," Access should be shut down, not left hanging with no open
database, so I’d eliminate the built-in option or change it to shut down
Access.


and another to close the database AND Access all
together.



Comment below regarding need.


5. Another option will print a report directly to the printer instead of
previewing it first.



OK, here’s my comment regarding need. Because an app should have menu items
and toolbar buttons that do the same thing that each of the switchboard
items, the *only* item you need in the switchboard manager is RunCode. Then
the menu, toolbar, and switchboard can call the same code without having to
keep duplicating it.



Now that’s a comment from a developer. However, you said you were targeting
beginning and intermediate users. That means that your enhancements should
be welcomed. And it also means that a lot of your target will also be using
macros.



Because of this, your comment in one of your other posts is unacceptable.
Just listing the macro objects is not enough. You *must* find a way to list
all of the macros in a group.


And it is the same interface that current user's are familiar with.
Nothing new to learn.



This is OK. Although the original manager is a little awkward, familiarity
is always good.


This would be my gift to the NG community and it could be posted somewhere for download if anyone
wants to use it.



Bless you. Sharing is a *good* thing.


(I do not have my own web site) It could be on the Access Web possibly



If you make it tight and it does not error out every time you turn around, I
bet Arvin will post it. If he doesn’t, let me know and I’ll let you put it
on my site.


(always been
a dream of mine to have something posted there).<g>



Ah, an ego thing! I resemble that. :) I’ll tell you a little story offline
sometime.


For me this was a new area of Access development. Along the way I've learned how to create a form
and controls in code, paste code into a new form module, the inner workings of some of the Access
wizards, as well as how to create an Add-In and what requirements are needed. I've enjoyed the
experience.



Excellent. Although I’ve done some of that in VB, I have to spend some time
to get up to speed in Access.


Right now I'm also making a special surprise for one of the MVPs while I'm learning another new area
of Access.



Cool. I can’t wait to here who and what. :)


Good to know.


Believe it or not you've helped IMMENSELY!



Glad to have been of assistance.


I have some ideas and have been testing for only a few minutes, but I think I may be on to something
now! I will post back with my results.



Please keep us posted.


Thank you very much Sco!



You’re most welcome.





If you’re curious, here are some of the enhancements I’ve made to the
switchboard form.



Increased the button count to 12

Made a way to open the form to any of the sub switchboards

Added security based on the Windows logon to make items selectively display

Added color coding to item labels based on this security

And of course lots of cosmetic stuff



This is one piece of my security system works very well when the complexity
of Jet security is not justified.





BTW Jeff, I keep meaning to ask. What part of the country are you in? From a
comment you made once about time zones, I get a feeling you are somewhere
west of Denver. ;-)



Keep up your good work.



Sco
 
M

M.L. Sco Scofield

Jeff,

Inline...

Sco

Jeff Conrad said:
Hi Sco,

Thanks for the sample file illustrating what a macro group looks like.



Again, you’re most welcome.


It now makes perfect sense to me.



Ah! Enlightenment! Most excellent! :)


The form events as well as the Switchboard Manager combo box do list the macro objects shown in the
Database Window as well as any macro groups. This really helped me visualize the difference.

I thought I was on to something by changing the code on the form sbm_frmEditSbItem from this:

Case CMD_RUNMACRO
cst = wlib_CGetExecutableMacros(wlib_dbCur, rgst())

to this:

Case CMD_RUNMACRO
cst = wlib_GetObjList(wlib_dbCur, acMacro, rgst(), &HFFFFF)

No errors at all on the later Access versions.

When I ran my advanced add-in, however, sure enough only the macro listed in the Database Window was
displayed. Darn!! I think I may just have to live with this restriction



As I mentioned in my last post, this is not acceptable because of your
intended users.


since it would seem to be
extremely difficult to duplicate the functionality of the entry points referenced throughout the
code.
:-(



Somehow you’ve got to find a way.


So close.



As they say, close only counts in horseshoes. :)



(And I once heard also hand grenades and atom bombs..)





Keep digging.



Sco



<snip>
 
M

M.L. Sco Scofield

Jeff,

I did a little Googling (newsgroups) using some of the routine names from
the 97 code.

I didn't find a replacement, but I did find some interesting comments that
gave me some things to ponder.

Short answer, it is going to be possible to get the names.

Long answer, it is going to take jumping through a few extra hoops.

Here's the deal. I'd like you to do a little more poking around and see what
you can come up with. Then, and I can't believe I'm saying this, let's take
this offline. Maybe after we get this sorted out we can come back and share
with the group what we come up with. Or not...

So, big guy, what's my cut for becoming a "partner" in this project? :)

Sco
 

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

Top