Hello
I'm trying to call this function but am getting the error "ByRef argument type mismatch"
I'm using Access 2k and calling this from form code.
thanQ for any ideas!
I'm trying to call this function but am getting the error "ByRef argument type mismatch"
I'm using Access 2k and calling this from form code.
Code:
Private Sub cmdDeleteRecord_Click()
Call DelRecord(strName) ' error here
End Sub
' delete routine
Private Sub DelRecord(strName As String)
On Error GoTo DelRecordErr:
Dim strSQL As String
strSQL = "Delete * FROM tblContacts WHERE " & _
"Lastname = '" & strName & "'"
DoCmd.RunSQL strSQL
Exit_DelRecord:
Exit Sub
DelRecordErr:
If Err.Number = 0 Then
Exit Sub
ElseIf Err.Number = 2501 Then
MsgBox "Action canceled by the user.", vbInformation, "Canceled"
Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, "Canceled"
End If
Resume Exit_DelRecord
End Sub