Avatar of pcalabria
pcalabria
Flag for United States of America asked on

Syntax Question - How can I CALL a procedure in the Backend of my split database?

I use MS Access 2K and a split front/back end structure.
The backend is also MS Access.

I have written a Public procedure in the MS Access back end that I need to call from the front end.

The name of the procedure in the backend is:

DeleteMyTable

which is setup as follows in a module

Public Sub DeleteMyTable
<<code here>>
end sub

How can I execute the DeleteMyTable code from the front end?
Microsoft Applications

Avatar of undefined
Last Comment
Jim Dettman (EE MVE)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
aikimark

Does the code delete the table in your FE database or the BE database?
Richard Daneke

The code can be called from the VBA in the front end.  You would have to create an instance of the backend database and call the code from the front end VBA connection.

If the code to delete a BE table were to be run from the FE database, wouldn't it just delete the linked table info and not the be table data?
pcalabria

ASKER
Thanks all.  I was trying to delete a table in the BE.  I wrote code in the BE and hoped to run it from the FE.

I solved the problem by writing different code in the FE do delete the BE table.  I never found a way to run the code from the FE.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Jim Dettman (EE MVE)

<<I solved the problem by writing different code in the FE do delete the BE table.  I never found a way to run the code from the FE. >>

 Well to answer that, the simpliest way is to set a VBA reference to your BE DB, at wich point you'd then be able to execute procedures in the BE.

If your dealing with code that works with objects in the curent DB (in this case the FE) then it's pretty stright forward.  But if in the called code DB (in this case the BE), you would need to be very careful with your coding.   You can lookup CodeDB() in the on-line help for additional comments.

The other way would be to invoke a second instance of Access with OLE automation, then execute the code.

Neither of those is really attractive for several reasons, so the best answer is to simply move the code into the FE.

With DAO or DML SQL statements, it's very easy to manipulate tables in a BE DB.

Jim.