Results 1 to 12 of 12
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get list for the desktop (Access 2000)

    I want to get the list of the databases present on the desktop.I can do it for other folders, but not for the desktop.I am applying the example where i fail to get the list for the files on the desktop.What is wrong with my list?

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Get list for the desktop (Access 2000)

    <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    It appears to work for me. When I open the form it created a record that listed my zips and mdb files on my desktop. I am running Access 2K3 here!
    Jerry

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get list for the desktop (Access 2000)

    Works fine in Access 2002 too. Are you sure you have .mdb and/or .zip files on your desktop?

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get list for the desktop (Access 2000)

    Oh My God ! There is not a single file with an ending mdb on my desktop ? I am awfully sorry !

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get list for the desktop (Access 2000)

    That explains it! <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get list for the desktop (Access 2000)

    In the attachement i have applied,and that works fine, i wanted to add on a code to get also the short cuts ending with .lnk on the desktop.I put the foolowing code:
    Private Function ShortCuts (ByRef strPath As String) As String
    Dim CheckFile As String
    Dim strList As String
    CheckFile = Dir(strPath & "/*.lnk")
    Do Until CheckFile = ""
    strList = strList & vbCrLf & CheckFile
    CheckFile = Dir
    Loop
    GetDBZList = Mid$(strList, 3)
    End Function

    Is my code all right? Because if it all right, i should look for my failure to perform somewhere else

    Thank you in advance

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get list for the desktop (Access 2000)

    You have named this function Shortcuts, so you must assign a value to Shortcuts, not to GetDBZList: change

    GetDBZList = Mid$(strList, 3)

    to

    Shortcuts = Mid$(strList, 3)

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get list for the desktop (Access 2000)

    Thank you very much for your email.I have rewritten my private function to be named GetDBZList and have written
    GetDBZList Me = Mid$(strList, 3) so with your help it is all right with the function.

    However in the OnLoad event of the form the line
    GetDBZList = Me.txtFolder
    is not correct,since it does not point to the desktop.What shall i right in this line?
    Otherwise the OnLoad event as it is right now is :

    Private Sub Form_Load()
    Application.SetOption ("Show Hidden Objects"), False

    Me.txtFolder = "C:BE"
    GetDBList Me.txtFolder
    GetDBZList Me.txtFolder
    GetDBLnkList = Me.txtFolder
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)
    ' Move to new record
    RunCommand acCmdRecordsGoToNew
    Me.txtFolder = "C:BEstore"
    GetDBList Me.txtFolder
    GetDBZList Me.txtFolder
    GetDBLnkList = Me.txtFolder
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)
    ' Move to new record
    RunCommand acCmdRecordsGoToNew
    Me.txtFolder = GetDesktop
    GetDBList Me.txtFolder
    GetDBZList Me.txtFolder
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)

    End Sub


    Thank you in advance

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get list for the desktop (Access 2000)

    There are many superfluous lines in your code. Try this:

    Private Sub Form_Load()
    Me.txtFolder = "C:BE"
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)

    ' Move to new record
    RunCommand acCmdRecordsGoToNew
    Me.txtFolder = "C:BEstore"
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)

    ' Move to new record
    RunCommand acCmdRecordsGoToNew
    Me.txtFolder = GetDesktop
    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)
    End Sub

  10. #10
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get list for the desktop (Access 2000)

    Thank you so much for your explanation.I get no errors now but i do not get the shortcuts.May be i cannot get them with the endings i include ?

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get list for the desktop (Access 2000)

    You have now created a function GetDBLnkList but you don't use it when filling the txtDatabaseList text box. Change

    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder)

    to

    Me.txtDatabaseList = GetDBList(Me.txtFolder) & vbCrLf & GetDBZList(Me.txtFolder) & _
    vbCrLf & GetDBLnkList(Me.txtFolder)

  12. #12
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get list for the desktop (Access 2000)

    Thank you, Dear Hans. My code now is great ! Super !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •