M
marie
I have a frontend (*.adp) - backend (Sqlserver) application.
I made a command button on a form that takes the current record,
duplicates it and then displays the new identical record.
When I compile the procedure, I haven't errors, but when I click on a
command button I get message 'Type mismatch'.
I have selected reference MS DAO 3.6. Object Library.
What's wrong?
Thanks in advance, Marie
Private Sub cmd_Duplicate_Click()
On Error GoTo Err_cmd_Duplicate_Click
Dim Sifr As Long
Dim RstDup As Recordset
Sifr = Me.ID
Set RstDup = Me.RecordsetClone
DoCmd.GoToRecord , , acNewRec
RstDup.FindFirst "[ID]=" & Sifr
If Not RstDup.NoMatch Then
Me!ID_nar = RstDup!ID_nar
Me!ID_izv = RstDup!ID_izv
'etc.
RunCommand acCmdSaveRecord
End If
RstDup.Close
Set RstDup = Nothing
Exit_cmd_Duplicate_Click:
Exit Sub
Err_cmd_Duplicate_Click:
MsgBox Err.Description
Resume Exit_cmd_Duplicate_Click
End Sub
I made a command button on a form that takes the current record,
duplicates it and then displays the new identical record.
When I compile the procedure, I haven't errors, but when I click on a
command button I get message 'Type mismatch'.
I have selected reference MS DAO 3.6. Object Library.
What's wrong?
Thanks in advance, Marie
Private Sub cmd_Duplicate_Click()
On Error GoTo Err_cmd_Duplicate_Click
Dim Sifr As Long
Dim RstDup As Recordset
Sifr = Me.ID
Set RstDup = Me.RecordsetClone
DoCmd.GoToRecord , , acNewRec
RstDup.FindFirst "[ID]=" & Sifr
If Not RstDup.NoMatch Then
Me!ID_nar = RstDup!ID_nar
Me!ID_izv = RstDup!ID_izv
'etc.
RunCommand acCmdSaveRecord
End If
RstDup.Close
Set RstDup = Nothing
Exit_cmd_Duplicate_Click:
Exit Sub
Err_cmd_Duplicate_Click:
MsgBox Err.Description
Resume Exit_cmd_Duplicate_Click
End Sub