Problems creating a table based on a stored Query in an Access-MDB 
Author Message
 Problems creating a table based on a stored Query in an Access-MDB

Following szenario:

1.) Creating a MS-Access DB via ADOX
2.) Creating an SQL Pass-through Queries ("MyQuery")
3.) Creating a new Table by executing an command based on the Query ("SELECT
* INTO MyTable FROM MyQuery")

The problem I have is that the command seems to be executed twice. I always
get the error "Table <MyTable> already exists" when the command is executed.

Has anybody an idea whats going wrong ?

Thanks in advance !!

Peter.


============================================================================
==============================================

 Dim catDB As ADOX.Catalog
 Dim cmd As ADODB.Command
 Dim cmd2 As ADODB.Command

 Set catDB = New ADOX.Catalog
 catDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\my.mdb"

 Set cmd = New ADODB.Command
 With cmd
    .ActiveConnection = catDB.ActiveConnection
    .CommandText = "select * from betmandmodul"
    .Properties("Jet OLEDB:ODBC Pass-Through Statement") = True
    .Properties("Jet OLEDB:Pass Through Query Connect String") =
"ODBC;DSN=kfz;UID=uid;PWD=pwd;"
 End With

 catDB.Procedures.Append "MyQuery", cmd

 Set cmd2 = New ADODB.Command
 With cmd2
   .ActiveConnection = catDB.ActiveConnection
   .CommandText = "select * INTO MyTable from MyQuery"
 End With

 cmd2.Execute



Sat, 15 Nov 2003 19:38:40 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Executing Access Query Stored in MDB

2. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

3. Access locks when opening a table in an ADO created MDB

4. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

5. Create new fields in a table based off of fields in another table

6. Problem with creating a table in Access from existing table

7. Mettre à jour une structure de table de base de donnée mdb par code

8. table in mdb base

9. How to create a query to sort and extract data from an Access table

10. Converting dynamic query by example SQL to RDO based SQL Stored Procedure

11. Problem in creating a query joinning 3 tables having 1-many relationship

12. HELP: Creating an MDB based on a High-Level Language Structure with Array's

 

 
Powered by phpBB® Forum Software