View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
augustus augustus is offline
external usenet poster
 
Posts: 49
Default ADO to pull data into another worksheet

Hi,

This is my code:

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConn = strConn & "Data Source=" & Application.ActiveWorkbook.FullName & ";"
strConn = strConn & "Extended Properties='Excel 8.0;HDR=NO'"

strSQL = "SELECT 'Apple' FROM [SHEET1$A1:A4] WHERE [SHEET1$B1:B4] = 'TOM &
Co'"
With Conn
.CursorLocation = adUseClient 'default assumed not client
.ConnectionString = strConn
.Open
End With

Rs.Open strSQL, Conn 'Stopped here
.........

I get :
No value given for one or more required parameters

I read somewhere that I must use HeaderRow (HDR=YES) inorder to use other
SQL function, or else, I only get to use select. Is there way to get around
this?

I use A1:B4 (much larger in the real sheet) as a temp dump area, therefore,
I really don't want to use hearderrow, since other record also go here.

Thanks