SQL - array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to run a SQL Select on an array in VBA? If I Dim an array like
Dim x(100,100) as integer, can I perform a select statement on it?

Seems like you should be able to since it is like rows and columns from a
spreadsheet and is like a small database.

Thanks!
Dave
 
dave said:
Is there a way to run a SQL Select on an array in VBA? If I Dim an array like
Dim x(100,100) as integer, can I perform a select statement on it?

No, you cannot query an in-memory array. However, you could write the
array to a worksheet e.g.

Sheet1.Range("A1:CW101").Value = x

then query the workbook e.g.

SELECT F101
FROM
[Excel 8.0;HDR=No;Database=C:\MyWorkbook.xls;].[Sheet1$]
WHERE F1 <> 0;

Jamie.

--
 
I was afraid of that, thanks.
Dave


onedaywhen said:
dave said:
Is there a way to run a SQL Select on an array in VBA? If I Dim an array like
Dim x(100,100) as integer, can I perform a select statement on it?

No, you cannot query an in-memory array. However, you could write the
array to a worksheet e.g.

Sheet1.Range("A1:CW101").Value = x

then query the workbook e.g.

SELECT F101
FROM
[Excel 8.0;HDR=No;Database=C:\MyWorkbook.xls;].[Sheet1$]
WHERE F1 <> 0;

Jamie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top