T
thefonz37
I'm trying to get a set of data based on an option that the user selects on a
form (i.e., they select one of the options and then click and button, then
this code executes). Here's what I have so far:
Private Sub Command15_Click()
Dim printedRecords As String
Dim archivedQuery As String
If SelectPrint = 1 Then
DoCmd.OpenReport "rpt_All_Archived", acViewPreview
printedRecords = "SELECT tbl_Archived_Requests.ID,
tbl_Archived_Requests.[Printed?] FROM tbl_Archived_Requests INNER JOIN
qry_Print_All_Archived ON tbl_Archived_Requests.ID =
qry_Print_All_Archived.ID;"
Else
DoCmd.OpenReport "rpt_Selected_Archived", acViewPreview
printedRecords = "SELECT tbl_Archived_Requests.ID,
tbl_Archived_Requests.[Printed?] FROM tbl_Archived_Requests INNER JOIN
qry_Print_Selected_Archived ON tbl_Archived_Requests.ID =
qry_Print_Selected_Archived.ID;"
End If
Debug.Print printedRecords
Dim outRecords As DAO.Recordset
Set outRecords = CurrentDb().OpenRecordset(printedRecords)
The last line is giving me an error - "Run-time error: 3061. Too few
parameters. Expected: 3"
This is confusing because I use the OpenRecordset(<query string>) used in
another place in the database and it's working fine. So I guess I'm not sure
why the function is requesting 3 parameters here and not elsewhere.
form (i.e., they select one of the options and then click and button, then
this code executes). Here's what I have so far:
Private Sub Command15_Click()
Dim printedRecords As String
Dim archivedQuery As String
If SelectPrint = 1 Then
DoCmd.OpenReport "rpt_All_Archived", acViewPreview
printedRecords = "SELECT tbl_Archived_Requests.ID,
tbl_Archived_Requests.[Printed?] FROM tbl_Archived_Requests INNER JOIN
qry_Print_All_Archived ON tbl_Archived_Requests.ID =
qry_Print_All_Archived.ID;"
Else
DoCmd.OpenReport "rpt_Selected_Archived", acViewPreview
printedRecords = "SELECT tbl_Archived_Requests.ID,
tbl_Archived_Requests.[Printed?] FROM tbl_Archived_Requests INNER JOIN
qry_Print_Selected_Archived ON tbl_Archived_Requests.ID =
qry_Print_Selected_Archived.ID;"
End If
Debug.Print printedRecords
Dim outRecords As DAO.Recordset
Set outRecords = CurrentDb().OpenRecordset(printedRecords)
The last line is giving me an error - "Run-time error: 3061. Too few
parameters. Expected: 3"
This is confusing because I use the OpenRecordset(<query string>) used in
another place in the database and it's working fine. So I guess I'm not sure
why the function is requesting 3 parameters here and not elsewhere.