ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel2002 - use sql statements? (https://www.excelbanter.com/excel-programming/325985-excel2002-use-sql-statements.html)

ron

Excel2002 - use sql statements?
 
Hello,

Just checking if it is possible to define a range of data
in a sheet as a table for use with Sql Statements. Is
this doable?

Example: if I link an Excel sheet into an Access mdb I
can say "Insert Into Sheet1 Select * From Table1" where
table1 contains several rows of data which I can insert
directly into the linked sheet. But what I would like to
do is to take a range of data from an Excel Sheet and use
ADO command object to pass the data as a batch to an
Access mdb Table.

Pseudocode-----------------
cmd.CommandText = "Insert Into Table1 Select * From Sheet1"
or
cmd.CommandText = "Insert Into Table1 Select * From Rng1"
or (if Excel has a table object)
cmd.CommandText = "Insert Into Table1 Select * From
tblSheet1"

where (real pseudocode here)---------------
Dim tblSheet1 As Excel.Table
Set tblSheet1 = Rng1

Thanks

Fredrik Wahlgren

Excel2002 - use sql statements?
 

"Ron" wrote in message
...
Hello,

Just checking if it is possible to define a range of data
in a sheet as a table for use with Sql Statements. Is
this doable?

Example: if I link an Excel sheet into an Access mdb I
can say "Insert Into Sheet1 Select * From Table1" where
table1 contains several rows of data which I can insert
directly into the linked sheet. But what I would like to
do is to take a range of data from an Excel Sheet and use
ADO command object to pass the data as a batch to an
Access mdb Table.

Pseudocode-----------------
cmd.CommandText = "Insert Into Table1 Select * From Sheet1"
or
cmd.CommandText = "Insert Into Table1 Select * From Rng1"
or (if Excel has a table object)
cmd.CommandText = "Insert Into Table1 Select * From
tblSheet1"

where (real pseudocode here)---------------
Dim tblSheet1 As Excel.Table
Set tblSheet1 = Rng1

Thanks


http://support.microsoft.com/kb/278973/EN-US/

/Fredrik



ron

Excel2002 - use sql statements?
 
That was a great article. Thanks very much for the
reference.


-----Original Message-----

"Ron" wrote in

message
...
Hello,

Just checking if it is possible to define a range of

data
in a sheet as a table for use with Sql Statements. Is
this doable?

Example: if I link an Excel sheet into an Access mdb I
can say "Insert Into Sheet1 Select * From Table1" where
table1 contains several rows of data which I can insert
directly into the linked sheet. But what I would like

to
do is to take a range of data from an Excel Sheet and

use
ADO command object to pass the data as a batch to an
Access mdb Table.

Pseudocode-----------------
cmd.CommandText = "Insert Into Table1 Select * From

Sheet1"
or
cmd.CommandText = "Insert Into Table1 Select * From

Rng1"
or (if Excel has a table object)
cmd.CommandText = "Insert Into Table1 Select * From
tblSheet1"

where (real pseudocode here)---------------
Dim tblSheet1 As Excel.Table
Set tblSheet1 = Rng1

Thanks


http://support.microsoft.com/kb/278973/EN-US/

/Fredrik


.



All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com