?
Solved

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

Posted on 2013-12-15
5
Medium Priority
?
302 Views
Last Modified: 2013-12-20
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?
0
Comment
Question by:pcalabria
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39721151
<<How can I execute the DeleteMyTable code from the front end? >>

 You can't easily.  Far better off to move the procedure to your front end.

  That after all is the setup a FE/BE should have; BE is nothing but data, FE is everything else.

Jim.
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39722519
Does the code delete the table in your FE database or the BE database?
0
 
LVL 19

Expert Comment

by:Richard Daneke
ID: 39722792
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?
0
 

Author Closing Comment

by:pcalabria
ID: 39730943
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.
0
 
LVL 58
ID: 39731570
<<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.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question