Not sure if I should put this in the "Queries" forum or "Programming" but I have a Function that loops through and runs 12 queries I have listed in a table. 3 of those queries have criteria that is tied to a text or combo box on my form. When it gets to the first query that has the criteria of Forms!frmDP!Text22 it should run with the criteria the user selected. Instead I am getting a "Too few parameters expected 1" error message and can't find anything to tell me what I'm missing.
Query 1 criteria - Forms!frmDP!Text22
Query 2 criteria - Forms!frmDP!cboSeason
Query 3 criteria - Forms!frmDP!cboSeason
Public Function fQueryBatch() As Byte
Dim strSQL As String
'Dim strSQLFinal As String
strSQL = "SELECT * FROM tQueries ORDER BY queryorder ASC"
With CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
Do Until .EOF
CurrentDb.Execute .Fields("qname"), dbFailOnError
.MoveNext
Loop
End With
Dim stDocName As String
stDocName = "qFcst_Workbook_7_Final"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Function
Any help would be appreciated. I was thinking that I may need to add a "WHERE" clause to my strSQL but doesn't the criteria line of "Forms!frmDP!cboSeason" have the same affect?
Thanks,
Toni