I have the following code which gets a set of records (qrySelectClosedRecords) and then appends those records to another table.
However on the line 'CurrentDb.Execute "qryArchiveRecords", dbFailOnError' I am getting two few parameters. expected 1 error.
The qrySelectClosedRecords does have a parameter as below:
qryArchiveRecords is meant to take that list and append them to the new table.
However on the line 'CurrentDb.Execute "qryArchiveRecords", dbFailOnError' I am getting two few parameters. expected 1 error.
The qrySelectClosedRecords does have a parameter as below:
Code:
PARAMETERS [Forms]![frmDashboard]![cboBankArchive] Text ( 255 );
SELECT PermTESTAC.*
FROM PermTESTAC
WHERE (((PermTESTAC.AddressType)=[Forms]![frmDashboard]![cboBankArchive]) AND ((PermTESTAC.Closed)="Yes"));
qryArchiveRecords is meant to take that list and append them to the new table.
Code:
Private Sub btnArchiveFiles_Click()
On Error GoTo btnArchiveFiles_Click_Err
Dim RecordCount As String
DoCmd.SetWarnings (False)
RecordCount = DCount("*", "qrySelectClosedRecords")
If MsgBox("Are you sure you wish to archive " & RecordCount & " records?", vbYesNo + vbExclamation) = vbYes Then
CurrentDb.Execute "qryArchiveRecords", dbFailOnError
'CurrentDb.Execute "qryDeleteClosedFiles", dbFailOnError
MsgBox "You have successfully archived " & RecordCount & " records", vbInformation
Exit Sub
Else
Exit Sub
End If
DoCmd.SetWarnings (True)
btnArchiveFiles_Click_Exit:
Exit Sub
btnArchiveFiles_Click_Err:
MsgBox Error$
Resume btnArchiveFiles_Click_Exit
End Sub