Θέμα: Ερωτήματα Τι κάνω λάθος

Εμφάνιση ενός μόνο μηνύματος
  #4  
Παλιά 20-04-15, 20:26
anestaki Ο χρήστης anestaki δεν είναι συνδεδεμένος
Όνομα: Γιώργος
Έκδοση λογισμικού Office: Ms-Office 2007
Γλώσσα λογισμικού Office: Ελληνική
 
Εγγραφή: 05-02-2010
Μηνύματα: 196
Προεπιλογή

Καλησπέρα Γιώργο
Στον παρακάτω κώδικα με το node αναζητάμε το όνομα του χρηστή και στο ερώτημα MenuNodesQuery του μενού μας εμφανίζει τα δικαιώματα του.
Και αυτό για να αφαιρέσω την If Form_Frm_main.Usr = "1" Then και να έχω περισσότερες επιλογές.
Θα ήθελα να ανεβάσω της βάσης αλλά η μια με τους πινάκες είναι 3,24 ΜΒ και η άλλη 10,1 ΜΒ και δεν γνωρίζω άλλο τρόπο για να την δείτε.
Κώδικας:
Sub AddNodes()
'-----------------
    Dim myTree As Control
    Dim myImage As Control
    Dim db As DAO.Database
    Dim Rst As DAO.Recordset
    Dim strRelative As String
    Dim strKey As String
    Dim strText As String
    Dim strImage As String
    Dim strExpandedImage As String
    Dim node As Variant
    Set myTree = Me.TreeView1
    Set myImage = Me.ImageList1
    ' clear all nodes
    myTree.Nodes.Clear
    ' link Treeview object to Imagelist object
    myTree.ImageList = myImage.Object
    Set db = CurrentDb
    node = DLookup("struser", "tblEmployees", "lngEmpID=" & Form_frmLogon.cboEmployee)
    If Form_frmLogon.cboEmployee = "1" Then
    Set Rst = CurrentDb.OpenRecordset("SELECT * FROM MenuNodesQuery WHERE noteAdmin = TRUE")
    Else
    Set Rst = CurrentDb.OpenRecordset("SELECT * FROM MenuNodesQuery WHERE noteUsers = TRUE")
    End If
    With Rst
      If Not (.EOF And .BOF) Then
         Do Until .EOF
            If Len(Nz(.Fields("nodeParent"), "")) = 0 Then
               strKey = .Fields("nodeKey")
               strText = .Fields("nodeText")
               strImage = Nz(.Fields("nodePictureNormal"), "")
               myTree.Nodes.Add , , strKey, strText, strImage
            Else
               strRelative = .Fields("nodeParent")
               strKey = .Fields("nodeKey")
               strText = .Fields("nodeText")
               strImage = Nz(.Fields("nodePictureNormal"), "")
               strExpandedImage = Nz(.Fields("nodePictureExpanded"), "")
               'assume the first 4 fields will always have a value, but
               'strExpandedImage might have no value
            
               If strExpandedImage = "" Then
                  myTree.Nodes.Add strRelative, tvwChild, strKey, strText, _
                     strImage
                Else
                  myTree.Nodes.Add strRelative, tvwChild, strKey, strText, _
                     strImage, strExpandedImage
                End If
            
               'set value of nodes.tag property, if it is used (Note: nodes.image
               'and nodes.expandedImage properties only return values, and thus
               'cannot be used this way to set the values.)
            
               If Len(.Fields("nodeTag") & "") > 0 Then
                  myTree.Nodes(strKey).Tag = .Fields("nodeTag")
               End If
            End If
            .MoveNext
         Loop
      End If
   End With
   
   Rst.Close
   
   Set db = Nothing
   Set Rst = Nothing
    
End Sub
Απάντηση με παράθεση