Calling a form from a library database

T

ToniMaura

Access 2000 + SP3.
Database in 'mde' format, library in 'mde'.
I call a form from the library, when i have it in screen with the focus, no
menu option (from the database) work...
I have a function in every menu option like '=mnuCalc',...
it seems like access search the mnuCalc in the library database instead of
search in the database.
Somebody may help me?
Thanks
 
W

Woo Mun Foong

Hi,
You are right to say that MsAccess searches the Library db rather than the
main db
for the function.
I have done something similar and here my approach of calling the Main db
functions from the Library Database

I have a main db called MyMainProg.mdb
and within it I have a function :- MyMainFunction(strCustomerID) which is
called by my AddIn Library :- MyAddIn.mdb

Inside MyAddIn.mdb I code this,

Application.Run "MyMainProg.MyMainFunction", strCustomerID

and MsAccess will know how to make the call to MyMainProg's MyMainFunction
If you need an return value you can do this as well

Dim retID as Integer
retID = Application.Run ("MyMainProg.MyMainFunction", strCustomerID)

return value can be anything string, integer or User defined Datatype.
 
T

ToniMaura

ok, but the function is in a menu option, no in a vba module, I cannot write
'MyMainProg.MyMainFunction' inside the action option of a menu....

thanks
 
W

Woo Mun Foong

You can create a Public function inside a VBA Module and have your Menu
option pointed to the Public Function

Ex :
'Create a Public Function
Public Sub MyMenuOption()
Application.Run "MyMainProg.MyMainFunction", strCustomerID
End Sub

'In your Menu do this
=MyMenuOption
rather than
=mnuCalc

Or you can edit your mnuCalc to include the code above.

Thank You
 

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