Hello I am new to VBA and I am trying to create this program however I get the run time error 3061 Too few parameter expected_1, what does this mean, my code is:
Can someone please HELP!!
Code:
Sub Template_Provider_Retail(Spinner As String) Dim rs As Recordset Dim strSQL As String Dim i As Integer Dim IsSmall As Boolean Dim IsInsuf As Boolean wbMaster.Worksheets("Provider_Retail").Copy After:=wbReport.Worksheets(wbReport.Worksheets.Count) 'copies the pages strSQL = "Select Name, Retail_Credit_Index " & _ "FROM Retail_Credit_2007_Totals " & _ "WHERE Active = True " & _ "AND Name_2 = 'Total' " & _ "ORDER by Retail_Credit_Index Desc, Name Asc" Set rs = db.OpenRecordset(strSQL) With rs If Not .BOF Then .MoveLast 'Must do the movelast command to get the recordcount .MoveFirst Cells(14, 17).CopyFromRecordset rs, .RecordCount End If End With strSQL = "Select Name, Retail_Credit_Index " & _ "FROM Retail_Credit_2007 " & _ "WHERE Active = True " & _ "AND Name_2 = 'Total' " & _ "ORDER by Retail_Credit_Index Desc, Name Asc" Set rs = db.OpenRecordset(strSQL) With rs If Not .BOF Then .MoveLast 'Must do the movelast command to get the recordcount .MoveFirst Cells(14, 22).CopyFromRecordset rs, .RecordCount End If End With strSQL = "Select Name, Retail_Credit_Index " & _ "FROM Retail_Credit_2006_Totals " & _ "WHERE Active = True " & _ "AND Name_2 = 'Total' " & _ "ORDER by Retail_Credit_Index Desc, Name Asc" Set rs = db.OpenRecordset(strSQL) With rs If Not .BOF Then .MoveLast 'Must do the movelast command to get the recordcount .MoveFirst Cells(26, 17).CopyFromRecordset rs, .RecordCount End If End With strSQL = "Select Name, Retail_Credit_Index " & _ "FROM Retail_Credit_2006 " & _ "WHERE Active = True " & _ "AND Name_2 = 'Total' " & _ "ORDER by Retail_Credit_Index Desc, Name Asc" Set rs = db.OpenRecordset(strSQL) With rs If Not .BOF Then .MoveLast 'Must do the movelast command to get the recordcount .MoveFirst Cells(26, 22).CopyFromRecordset rs, .RecordCount End If End With rs.Close Set rs = Nothing Cells.Copy 'COPY ALL THE CELLS IN A WORKBOOK Cells.PasteSpecial xlPasteValues 'so it breaks the links
Can someone please HELP!!
Comment