Deletes Tables in Backend imports into Front End (1 Viewer)

new_2_prog

Registered User.
Local time
Today, 00:42
Joined
Aug 4, 2008
Messages
58
I posted this before with no resolve, hoping this time around with better results.

I have a function in the back end of my database that deletes and imports tables from MAS90, I can not link to these tables so the best resolve is nightly the tables are deleted and re-imported, works fine.

BUT, there is an occasion to force this to happen and I call the function from a form in the front end of the split database. It deletes the tables in the backend like it should but then proceeds to import them into the front end.

Note*In the front end I went to Tools, References and found the back end database in order to call the function but why the glitch?

I have been trying to find with the TransferDatabase for the destination is there a way to designate the backend of the database is where the tables should be imported to?

DoCmd.TransferDatabase acImport, "ODBC", "C:\WINDOWS\DESKTOP;CODEPAGE=1252;;TABLE=JC2_JobCostDetail", acTable, "JC2_JobCostDetail", "JC2_JobCostDetail", False

Thanks!
 

SimonB1978

Registered User.
Local time
Today, 03:42
Joined
Jan 22, 2009
Messages
161
Perhaps you could import in your FE in a temp table and use DoCmd.CopyObject to copy the table into the BE.

Not the best but it should work....
 

boblarson

Smeghead
Local time
Today, 00:42
Joined
Jan 12, 2001
Messages
32,059
The issue is where you are using the DoCmd.TransferDatabase. It is easy to do if you can open the backend programmatically, but to do so you would need your front end to not be linked to it in any way at the time so it has exclusivity to the database. The code to do it would be something like this:

Code:
Dim db As DAO.Database
 
Set db = OpenDatabase("YourPathAndFileNameHere")
 
db.DoCmd.TransferDatabase acImport, "ODBC", "C:\WINDOWS\DESKTOP;CODEPAGE=1252;;TABLE=JC2_JobCo stDetail", acTable, "JC2_JobCostDetail", "JC2_JobCostDetail", False

db.Close
Set db = Nothing
 

Users who are viewing this thread

Top Bottom