creepr91
May 12th, 2006, 10:05 PM
hi,
I trying to query an Excel file and only return certain fields and with specific criteria and populate a flexgrid.
My Excel sheet I am pulling the data from is Sheet1
and the first row of the columns I want are Model_Number and Date_Received
1. When I use SELECT * FROM [sheet1] I get all of the data
Any time I try to select specific fields I get no data.
I have tried SELECT [sheet1].model_number
I have tried SELECT [model_number]
I have tried SELECT model_number
I have tried SELECT field2
None return any data.
2. I am also having issues with my WHERE statements, but I guess since it is not recognizing my field names my problems are linked.
Any ideas? I do alot of SQL server and access programming, 1st time playing with Excel.
Here is my code for that section
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "SELECT model_number FROM [sheet1$] WHERE [Model_Number] = "sps5669-2"
Set Rs1 = Cmd1.Execute()
Thanks,
Vince
I trying to query an Excel file and only return certain fields and with specific criteria and populate a flexgrid.
My Excel sheet I am pulling the data from is Sheet1
and the first row of the columns I want are Model_Number and Date_Received
1. When I use SELECT * FROM [sheet1] I get all of the data
Any time I try to select specific fields I get no data.
I have tried SELECT [sheet1].model_number
I have tried SELECT [model_number]
I have tried SELECT model_number
I have tried SELECT field2
None return any data.
2. I am also having issues with my WHERE statements, but I guess since it is not recognizing my field names my problems are linked.
Any ideas? I do alot of SQL server and access programming, 1st time playing with Excel.
Here is my code for that section
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "SELECT model_number FROM [sheet1$] WHERE [Model_Number] = "sps5669-2"
Set Rs1 = Cmd1.Execute()
Thanks,
Vince