1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Private Function GotoThisRecord(ByRef TargetForm As Form, ByVal WhatRecordID As Long, ByVal FieldName As String, ByVal ItemMessage As String)
Dim oRS As dao.Recordset
On Error GoTo ErrGotoRecord
Set oRS = Me.Recordset.Clone
With oRS
.FindFirst "[" & FieldName & "] = " & WhatRecordID
If .NoMatch = False Then
TargetForm.Bookmark = .Bookmark
Else
Err.Raise 3021
End If
.Close
End With
ExGotoRecord:
Set oRS = Nothing
Exit Function
ErrGotoRecord:
MsgBox "Il n'existe pas d'enregistrement pour " & ItemMessage & " ayant " & WhatRecordID & " comme valeur de champ " & FieldName & " !", vbExclamation
Resume ExGotoRecord
End Function |
Partager