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

Application.Run with custom add-ins

P: n/a
I have a custom add-in which is installed via the Add-In Manager and works
fine when called manually from the Add-Ins menu. The goal is to be able to
run the entry function of the add-in from code in the current database.
Normally, all that is needed to do it is to use

Application.Run "[addin project name].[entry function name]"

This indeed works in the A97 version of the same add-in. However, when I do
this in A2002 or A2003, Access crashes. The only time when Access does not
crash in this scenario is when before running the above statement, I
manually run the add-in from the menu. In this case, it will work as long
as Access remains open. So it looks as if Access needs to load and
"recognize" the add-in's VBA project before I can call a function in that
project from code. It does work if I explicitly add a reference to the add-
in, but I can't use that solution for unrelated reasons.

The entry function in the add-in is very simple:

Public Function dbp_Entry() As Boolean

DoCmd.OpenForm "frm"

End Function

where frm is a form in the add-in.

Any ideas, experiences, and workarounds would be appreciated.

--
remove a 9 to reply by email
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 02 May 2004 00:27:03 -0000, Dimitri Furman
<df*****@cloud99.net> wrote:

Maybe I'm way off base here, but couldn't you use CreateObject (and
thus late binding) if you don't like early binding?
Pseudo-code:
dim x as object
dim b as boolean
set x = createobject("myaddin")
b = x.dbp_Entry()

-Tom.

I have a custom add-in which is installed via the Add-In Manager and works
fine when called manually from the Add-Ins menu. The goal is to be able to
run the entry function of the add-in from code in the current database.
Normally, all that is needed to do it is to use

Application.Run "[addin project name].[entry function name]"

This indeed works in the A97 version of the same add-in. However, when I do
this in A2002 or A2003, Access crashes. The only time when Access does not
crash in this scenario is when before running the above statement, I
manually run the add-in from the menu. In this case, it will work as long
as Access remains open. So it looks as if Access needs to load and
"recognize" the add-in's VBA project before I can call a function in that
project from code. It does work if I explicitly add a reference to the add-
in, but I can't use that solution for unrelated reasons.

The entry function in the add-in is very simple:

Public Function dbp_Entry() As Boolean

DoCmd.OpenForm "frm"

End Function

where frm is a form in the add-in.

Any ideas, experiences, and workarounds would be appreciated.


Nov 12 '05 #2

P: n/a
On May 01 2004, 08:27 pm, Dimitri Furman <df*****@cloud99.net> wrote in
news:Xn****************************@127.0.0.1:
I have a custom add-in which is installed via the Add-In Manager and
works fine when called manually from the Add-Ins menu. The goal is to
be able to run the entry function of the add-in from code in the
current database. Normally, all that is needed to do it is to use

Application.Run "[addin project name].[entry function name]"

This indeed works in the A97 version of the same add-in. However, when
I do this in A2002 or A2003, Access crashes.


It always helps to reexamine things on a Sunday morning.

I have both A97 and A2002 installed on the same machine in different
directories. Turns out that the crash was caused by A2002 trying to load
the A97 version of the add-in from the Office 97 directory. Both versions
of the MDA file were named the same, so the trivial workaround was to make
add-in names version-specific.

Whether or not the add-in was previously installed using the Add-In Manager
has no relevance on being able to run the code from the add-in using
Application.Run, although it does work if the add-in was run at least once
from the menu in the current Access session. Otherwise you get error 2517,
"Microsoft Access can't find the procedure ...". To make it work
regardless, you need to copy the add-in into Access directory, which
AFAIK is the suggested way to do it since Access 2.0...

--
remove a 9 to reply by email
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.