I need help opening up an Excel spreadsheet and reading the spreadsheet columns into a records set (as you would with a normal database.
Ive got the basic code but Icant seem to get it to work :
Dim db As Database
Dim rs As Recordset
Dim filepath As String
Dim sheetname As String
Private Sub Command1_Click()
filepath = "\\ltfoxs01\fis$\Terms Discount Test\BudgetZPICS.xls"
sheetname = "BUDGETZPICS$"
'rs.Close
'db.Close
Set db = OpenDatabase(filepath, False, False, "Excel 8.0;HDR=yes;"
Set rs = db.OpenRecordset(sheetname) '<<TYPE MISMATCH ERROR HERE
Do While rs.EOF = False
cboProduct.AddItem (rs!productid)
rs.MoveNext
Loop
End Sub
What am I doing wrong
Ive got the basic code but Icant seem to get it to work :
Dim db As Database
Dim rs As Recordset
Dim filepath As String
Dim sheetname As String
Private Sub Command1_Click()
filepath = "\\ltfoxs01\fis$\Terms Discount Test\BudgetZPICS.xls"
sheetname = "BUDGETZPICS$"
'rs.Close
'db.Close
Set db = OpenDatabase(filepath, False, False, "Excel 8.0;HDR=yes;"
Set rs = db.OpenRecordset(sheetname) '<<TYPE MISMATCH ERROR HERE
Do While rs.EOF = False
cboProduct.AddItem (rs!productid)
rs.MoveNext
Loop
End Sub
What am I doing wrong