Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lookup filenames in combo box (2002, SP3)

    Is it possible to display filenames from a specific folder in a combo box? I have a user who will be working with bids in an Access database. Once the bid award has been made, the tables containing info from that bid are saved in a specific folder with a name to denote which bid the items pertained to. At a later time they may want to go back to that data. What I would like to do is have a database front end designed to review a prior bid by having them select the bid name from a combo box and then have code that would link to that particular database.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: Lookup filenames in combo box (2002, SP3)

    Yes, it would be possible to fill a combo box with file names, but wouldn't it be easier to display the standard Open dialog? Here is some sample code:

    Function SelectFile(strFolder As String) As String
    With Application.FileDialog(msoFileDialogOpen)
    .Filters.Clear
    .Filters.Add "Access Databases", "*.mdb"
    .InitialFileName = strFolder
    If .Show = True Then
    SelectFile = .SelectedItems(1)
    End If
    End With
    End Function

    This function can be used in the On Click event of a command button, for example:

    Private Sub cmdSelect_Click()
    Dim strFile As String
    strFile = SelectFile("H:Bids")
    If strFile = "" Then
    MsgBox "No file selected.", vbCritical
    Exit Sub
    End If
    ' Do something with the filename
    ...
    End Sub

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lookup filenames in combo box (2002, SP3)

    That worked perfectly. Thank you so much.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

Posting Permissions

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