With the following code I get
error 3061 (Too few parameters. Expected 2)
Option Compare Database
Private Sub Command0_Click()
Dim xls As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Set xls = New Excel.Application
xls.Visible = True
xls.UserControl = True
Set wkb = xls.Workbooks.Open("link\Reliability Projects v5.xlsm", ReadOnly:=True, UpdateLinks:=False)
Set wks = wkb.Worksheets("Projects")
Dim RWPTitle As String 'there may be a better type to use here
RWPTitle = wks.Range("E10").Value
Text1.Value = RWPTitle
Dim EstimatedCapital As Currency 'there may be a better type to use here
EstimatedCapital = wks.Range("J10").Value
CurrentDb.Execute "INSERT INTO Table1 (PlanTitle, EstimatedCapitalCost) Values (RWPTitle, EstimatedCapital)"
wkb.Close False 'Close workbook. False is so that it doesn't save
Set wks = Nothing
Set wkb = Nothing
xls.Quit
Set xls = Nothing
End Sub
*When I try to use the INSERT INTO directly (No CurrentDb.EXECUTE) I get a
Compile Error - Expected:end of statement
and it highlights the Table name used.
Any ideas as to why this is happening to me?
Additionally, I am very new to VBA & Access. Any good references for functions / calls used to deal with databse and with excel files / info?