Ally
Registered User.
- Local time
- Today, 20:05
- Joined
- Sep 18, 2001
- Messages
- 617
I have a form, which is opened from another form. When I try doing anything on the second form, I get the error message:
Run-time error ‘3061’:
Too few parameters. Expected 2
The code that is running is:
The line highlighted is: Set r = db.OpenRecordset("qryPtACPDaily")
In the query there are 2 parameters:
[Forms]![frmACPData]![EpisodeID]
[Forms]![frmACPData]![UnitNo]
The query runs fine on its own (when the form’s open).
Does anyone know what’s wrong please?
Run-time error ‘3061’:
Too few parameters. Expected 2
The code that is running is:
Code:
Private Sub ACPDailyDate_Exit(Cancel As Integer)
Dim x, y, z As String
Dim r As Recordset, db As Database
Dim DocName As String
Dim LinkCriteria As String
DocName = "frmACPData"
Dim intNewRecord As Integer
intNewRecord = IsNull(Me.ACPDailyID)
Set db = CurrentDb()
Set r = db.OpenRecordset("qryPtACPDaily")
'If intNewRecord Then
Do Until r.EOF
If r.Fields("acpdailydate") = Me.ACPDailyDate.Value Then
msgbox r.Fields("PtFirstName") & " " & r.Fields
("PtLastName") & " already has ACP data for this date " & _
Chr(13) & r.Fields("acpdailydate"), vbOKOnly +
vbExclamation, "Warning"
DoCmd.Close
Exit Sub
ElseIf r.NoMatch Then
End If
r.MoveNext
Loop
'Else
Exit Sub
'End If
Me.Refresh
Exit Sub
End Sub
The line highlighted is: Set r = db.OpenRecordset("qryPtACPDaily")
In the query there are 2 parameters:
[Forms]![frmACPData]![EpisodeID]
[Forms]![frmACPData]![UnitNo]
The query runs fine on its own (when the form’s open).
Does anyone know what’s wrong please?
Last edited: