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
| Option Explicit
Dim rsPrincipale As ADODB.Recordset
Dim rsTable1 As ADODB.Recordset
Dim rsTable2 As ADODB.Recordset
Dim rsTable3 As ADODB.Recordset
Dim bndPrincipale As BindingCollection
Dim bndTable1 As BindingCollection
Dim bndTable2 As BindingCollection
Dim bndTable3 As BindingCollection
Private Sub dlApplications_Click()
'Pour sélectionner l'application dans la liste
Dim strApplication As String
strApplication = dlApplications.Text
rsPrincipale.MoveFirst
rsPrincipale.Find "Designation = '" & strApplication & "'"
End Sub
Private Sub Form_Load()
Set rsPrincipale = New ADODB.Recordset
Set rsTable1 = New ADODB.Recordset
Set rsTable2 = New ADODB.Recordset
Set rsTable3 = New ADODB.Recordset
Set bndPrincipale = New BindingCollection
Set bndTable1 = New BindingCollection
Set bndTable2 = New BindingCollection
Set bndTable3 = New BindingCollection
'Cette chaîne SQL a été générée automatiquement par le Data Environment.
'Elle est ici à titre d'information, car nous utilisons ici
'le data environment et non du code pour accéder aux données.
'Pour l'intéger dans du code, voir le praticiel "initiation à l'ccès aux données"
'dans la feuille SQL.
'SHAPE {SELECT * FROM `TablePrincipale`} AS cmdPrincipale APPEND
' ({SELECT * FROM `Table1`} AS cmdTable1 RELATE 'AppCode' TO 'AppCode') AS cmdTable1,
' ({SELECT * FROM `Table2`} AS cmdTable2 RELATE 'AppCode' TO 'AppCode') AS cmdTable2,
' ({SELECT * FROM `Table3`} AS cmdTable3 RELATE 'AppCode' TO 'AppCode') AS cmdTable3
deMultitables.rscmdPrinc.Open
Set rsPrincipale = deMultitables.rscmdPrinc
Set rsTable1 = deMultitables.rscmdPrinc!cmdTab1.Value
Set rsTable2 = deMultitables.rscmdPrinc!cmdTab2.Value
Set rsTable3 = deMultitables.rscmdPrinc!cmdTab3.Value
Set bndPrincipale.DataSource = rsPrincipale 'deMultitables.rscmdPrincipale
bndPrincipale.Add txtTP(0), "Text", "AppCode"
bndPrincipale.Add txtTP(1), "Text", "Designation"
Set bndTable1.DataSource = rsTable1
bndTable1.Add txtT1(0), "Text", "AppCode"
bndTable1.Add txtT1(1), "Text", "Data1"
bndTable1.Add txtT1(2), "Text", "Data2"
Set bndTable2.DataSource = rsTable2
bndTable2.Add txtT2(0), "Text", "AppCode"
bndTable2.Add txtT2(1), "Text", "Data1"
bndTable2.Add txtT2(2), "Text", "Data2"
Set bndTable3.DataSource = rsTable3
bndTable3.Add txtT3(0), "Text", "AppCode"
bndTable3.Add txtT3(1), "Text", "Data1"
bndTable3.Add txtT3(2), "Text", "Data2"
End Sub |
Partager