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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| Option Explicit
Public Function RechercherCourtier(ByVal pCode As String) As Boolean
' requetes
Dim sRequete As String
Dim rstLigneTable As ADODB.Recordset
Dim l_courtier As Courtier
Dim l_compteur As Integer
' ecran sortie
Procedures.initialiserResultats
' Affectation var
RechercherCourtier = False
Set l_courtier = New Courtier
l_courtier.initialiserTableauRechercherTitre
Range("D13").Value = " Recherche sur le code courtier : " & pCode
' Methodes
sRequete = "select * from courtier WHERE crt_code like '%" & pCode & "%'"
Set rstLigneTable = New ADODB.Recordset
' Ouverture DB
BDD.Open
' Enregistrement
Set rstLigneTable = New ADODB.Recordset
rstLigneTable.Open (sRequete), BDD
Call Procedures.presenterTitre(l_tableauRechercheTitre, 11)
' Boucle
l_compteur = 0
While Not rstLigneTable.EOF
RechercherCourtier = True
' Récup de données
Set l_courtier = New Courtier
l_compteur = l_compteur + 1
' Methode d'initialisation objet
Call l_courtier.constructorCrt(rstLigneTable("crt_code"), rstLigneTable("crt_nomdiri"), rstLigneTable("crt_prenomdiri"), rstLigneTable("crt_adresse"), rstLigneTable("crt_adresse_suite"), rstLigneTable("crt_cp"), rstLigneTable("crt_ville"), rstLigneTable("crt_telephone"), rstLigneTable("crt_portable"), rstLigneTable("crt_mail"), rstLigneTable("crt_siren"), rstLigneTable("crt_retrocession"))
' Affichage resultats
Procedure.presenterDonnees l_courtier.initialiserTableauRechercherValeur, 12, l_compteur
' Enregistrement suivant
rstLigneTable.MoveNext
Wend
' Fermeture BDD
rstLigneTable.Close
BDD.Close
End Function
Private Sub bc_rechcourt_Click()
'Recherche un courtier
Connexion.form_load
RechercherCourtier (t_rechcourt.Text)
End
End Sub |