Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two few parameters. Expected 1

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
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:
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

 


hi,

You will get better results, posting MS Access questions in one of the many MS Access forums like forum705.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top