1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Private Sub MODEL_TRP_DblClick(Cancel As Integer)
Dim db As Database
Dim rs As Recordset, rsSearch As Recordset
Dim msg As String 'Message pour msgbox
Dim tempValue As Variant 'Variable temporaire
Dim curRecord As Long 'Position absolue enregistrement courant
Dim totalLines As Long
On Error GoTo catch
'Enregistrement courant
curRecord = Me.Recordset.AbsolutePosition
If (curRecord = -1) Then
curRecord = 1
End If
totalLines = Me.Recordset.RecordCount
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT [AC_Model], [AC_Model_Final] " & _
"FROM TBL_RECOVERY_PARTS " & _
"WHERE [PO_Number] = '" & [PO_Number] & "' " & _
"AND [PO_Item] = " & [PO_Item] & " " & _
"AND [Goods_Receipt_Doc] = '" & [Goods_Receipt_Doc] & "' " & _
"AND [Invoice_Doc] = '" & [Invoice_Doc] & "' AND " & _
"[DELETED] = FALSE;", _
dbOpenDynaset)
'... ici je fais les modifications du recordset en fonction du choix de l'usager
' avec un rs.edit et rs.update
me.requery
'retour enregistrement courant
If (Me.Recordset.RecordCount > 0) And (curRecord > 0) Then
If (curRecord > Me.Recordset.RecordCount) Then
Me.Recordset.AbsolutePosition = Me.Recordset.RecordCount
Else
Me.Recordset.AbsolutePosition = curRecord
End If
End If
If (totalLines = Me.Recordset.RecordCount) Then
Me.RecordSource = "QRY_SELECT_MISSING_INFOS_RECOVERY_PARTS"
Me.Refresh
Me.Requery
End If
'... Gestion des erreurs ici (Je n'ai aucune erreur lorsque le requery ne fonctionne pas.
end sub |
Partager