Delete Server Table from Access Application

Alika

Registered User.
Local time
Today, 07:59
Joined
Mar 31, 2004
Messages
22
I'm exporting tables from Access database to SQL Server database
(that what i really need is to export xls file data to SQL Server; I don't know if VBA lets us to do it directli, therefore, at-first I export xls file to Access db and then form Access to Server):
DoCmd.TransferDatabase acExport, "ODBC Database", _
"ODBC;SERVER=serverName;UID=login;PWD=password;" _
& "DATABASE=ActiveAccounts", acTable, "tblActiveAccounts2004", "dbo.tblActiveAccounts2004".
If a table with such name already exists in SQL Server database, I'm getting error message:
"ODBC -- call failed... There is already an object named 'dbo.tblActiveAccounts2004' in the database"
How can we check from Access application (via VBA) if the SQL Server table exists and if it does, how can we delete the SQL Server table from Access (via VBA)?
Thank you.
 
Alika said:
I'm exporting tables from Access database to SQL Server database
Why not just link the table from within Access then no export is required.
 
___ said:
Why not just link the table from within Access then no export is required.
The data is primarily stored as xls file, this is the format user receives the data. xls file usually has something about a million of records. Access will run queries with such data for something about 24h. SQL Server runs the query for a couple of minutes.
This is why I think I need data to be stored and run from Server (But the result should be output back to xls file).

Any idea?
 
If I understand correctly, you could create a DTS package to import the data from Excel into the table within the server, run the query and export back to Excel.
 
___ said:
If I understand correctly, you could create a DTS package to import the data from Excel into the table within the server, run the query and export back to Excel.
Exporting needs to be done programmaticaly. User uses Access application as an Interface. All user can do - is to push a button. Can a DTS Package be executed from MS Access or MS Excel (I've never worked with DTS Packages before)? If so can I get some help with code.
On Internet (http://www.devarticles.com/c/a/ASP/Creating-DTS-Packages-With-SQL-Server-2000/3/) i found ActiveX Script Task code that exports the result of the DTS Global Variable (which is a result of a SELECT statement) to Text file. WHen I tried to execute my DTS Package with this code (to get the idea on how all these works) the execution failed due to ActiveX Script TAsk Error Occurred.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom