lookforsmt
Registered User.
- Local time
 - Today, 20:29
 
- Joined
 - Dec 26, 2011
 
- Messages
 - 672
 
HI! all, I have form with button on click event with below code
	
	
	
		
After i click the button, it should prompt the user to input the "IncidentId" which is a number field.
I am getting an error "Run-time error 3265, "Item Not found in this collection"
can anyone help with the correct code
Thanks
 
		Code:
	
	
	Private Sub Command95_Click()
  On Err GoTo Park
    
    Dim rec As Recordset
    Dim qdef As DAO.QueryDef
    Dim IncidentId As Integer
    
    Set qdef = CurrentDb.QueryDefs("qry_Voucher")
    qdef.Parameters("Entry Id").Value = IncidentId
    qdef.Execute
    MsgBox qdef.RecordsAffected & " - " & IncidentId & " " & " added"
    Set qdef = Nothing
    Set rec = qdef.OpenRecordset
Park:
    If Err.Number > 0 Then
        MsgBox Err.Number & " " & Err.Description
    End If
        If Me.Dirty Then
            Me.Dirty = False ' save the record
        End If
End Sub
	After i click the button, it should prompt the user to input the "IncidentId" which is a number field.
I am getting an error "Run-time error 3265, "Item Not found in this collection"
can anyone help with the correct code
Thanks