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
|
'Recherche Tel
Private Sub RechTel_AfterUpdate()
On Error Resume Next
Dim x As Variant
x = RechTel
Dim bd As dao.Database
Set bd = CurrentDb()
Dim rst As Recordset
Dim Chstr As String
Dim chsts As String
Dim chstt As String
'Recherche sur le tel des contacts
Chstr = "SELECT Contacts.noprospects, Contacts.nocontact, Contacts.TelContact FROM Contacts WHERE ((Contacts.TelContact) Like " & Chr(39) & Chr(42) & x & Chr(42) & Chr(39) & ")"
Set rst = bd.OpenRecordset(Chstr)
rst.MoveFirst
DoCmd.GoToControl "NoProspects"
DoCmd.FindRecord rst("NoProspects"), , True, , True
'S'il ne trouve rien, recherche sur les tels des prospects
If NoProspects <> rst("NoProspects") Then
chsts = "SELECT prospects.noprospects, prospects.TelProspects FROM prospects WHERE ((prospects.TelProspects) Like " & Chr(39) & Chr(42) & x & Chr(42) & Chr(39) & ")"
Set rst = bd.OpenRecordset(chsts)
rst.MoveFirst
DoCmd.GoToControl "NoProspects"
DoCmd.FindRecord rst("NoProspects"), , True, , True
'S'il ne trouve rien recherche sur les mobiles des prospects
If NoProspects <> rst("NoProspects") Then
chstt = "SELECT Contacts.noprospects, Contacts.nocontact, Contacts.MobileContact FROM Contacts WHERE ((Contacts.MobileContact) Like " & Chr(39) & Chr(42) & x & Chr(42) & Chr(39) & ")"
Set rst = bd.OpenRecordset(chstt)
rst.MoveFirst
DoCmd.GoToControl "NoProspects"
DoCmd.FindRecord rst("NoProspects"), , True, , True
If NoProspects <> rst("NoProspects") Then
MsgBox "Pas de Résulat pour votre Recherche"
End If
End If
End If
RechTel = "" ' permet de remettre le champs à 0
End Sub |
Partager