Bonjour a tous,
Voila mon petit problème,
J'ai un treeview et je voudrais quand je double-clique sur ma branche que le formulaire correspondant s'ouvre :
voici le code :
merci pour votre aide et bonne journée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub Xtree_DblClick() Dim oTree, NodeClic As Node Dim strFormname As String Dim x As Object Dim RS As DAO.Recordset Dim db As Database Dim Dossiers As DAO.Recordset '---------------------------- 'Ouverture des connexions '---------------------------- Set oTree = Me.Xtree.Object Set db = CurrentDb() Set RS = db.OpenRecordset("Dossiers") If RS.RecordCount = 0 Then RS.Close Set RS = Nothing MsgBox "Aucun dossier n'est sélectionné.", vbInformation, "Treeview" Exit Sub End If RS.MoveLast RS.MoveFirst With RS While Not RS.EOF strFormname = DLookup("DETAIL_DOSSIER", "Dossiers", "ID_DOSSIER =" & Mid(oTree.SelectedItem.Key, 2)) With x = strFormname DoCmd.OpenForm "x", , , "Dossiers", "ID_DOSSIER =" & Mid(oTree.SelectedItem.Key, 2) End With RS.MoveNext Wend End With End Sub
Partager