J
Judy Ward
I would like to query an Excel spreadsheet using code behind an Access form
to check a value in the spreadsheet before importing it.
This is what I am using--but it's not working:
(importFile is the path/filename and I'm sure that is correct)
Dim db As Database
Dim strQry As String
Dim rs As DAO.Recordset
Set db = CurrentDb
strQry = "SELECT SWIT_IR_Tag from [Excel 8.0;HDR=Yes;" & _
"DATABASE=" & importFile & "].SWIT_SAR_Status"
Set rs = db.OpenRecordset(strQry)
I get: Run-time error '3011':
The Microsoft Jet database engine could not find the object
'SWIT_SAR_Status'. Make sure the object exists and that you spell its name
and the path correctly.
I am sure that the object exists and that the name is correct. I have even
tried renaming the spreadsheet to something more simple. I have tried using
SWIT_SAR_Status$. I am using Access 2003 SP3.
If I were able to get the recordset, I was just going to go the the first
record and check the value of the field "SWIT_IR_Tag".
Does anyone know what I am doing wrong or have a suggestion for another way
to accompllish this?
Any help would be appreciated.
Thank you,
Judy
to check a value in the spreadsheet before importing it.
This is what I am using--but it's not working:
(importFile is the path/filename and I'm sure that is correct)
Dim db As Database
Dim strQry As String
Dim rs As DAO.Recordset
Set db = CurrentDb
strQry = "SELECT SWIT_IR_Tag from [Excel 8.0;HDR=Yes;" & _
"DATABASE=" & importFile & "].SWIT_SAR_Status"
Set rs = db.OpenRecordset(strQry)
I get: Run-time error '3011':
The Microsoft Jet database engine could not find the object
'SWIT_SAR_Status'. Make sure the object exists and that you spell its name
and the path correctly.
I am sure that the object exists and that the name is correct. I have even
tried renaming the spreadsheet to something more simple. I have tried using
SWIT_SAR_Status$. I am using Access 2003 SP3.
If I were able to get the recordset, I was just going to go the the first
record and check the value of the field "SWIT_IR_Tag".
Does anyone know what I am doing wrong or have a suggestion for another way
to accompllish this?
Any help would be appreciated.
Thank you,
Judy