Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2002
    Location
    Banbury, UK
    Posts
    7

    Question Unanswered: using a combo box to browse for a file

    I would like to be able to use an entry in a combo box to browse for a filename, allowing we to specify a certain number of locations for a database, and if the database is not in any of these locations, allows the user to browse for this file, eg:

    c:\progbk10\db3.mdb
    c:\progbk10\update\db3.mdb
    browse..

    this entry is then stored as a variable and used to import table data.

    Any ideas??

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Have you tried to use the common dialog control ?

  3. #3
    Join Date
    Aug 2002
    Location
    Banbury, UK
    Posts
    7

    What?

    Whats that?

  4. #4
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Look under insert -> activex control. This is a dialog control that handles open/save as/... functionality for you.

  6. #6
    Join Date
    Aug 2002
    Location
    Banbury, UK
    Posts
    7
    Originally posted by rnealejr
    Look under insert -> activex control. This is a dialog control that handles open/save as/... functionality for you.

    You must have a different version/add in to me, because I've looked there, and none of them mention find file, open or save in my list

  7. #7
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Here is some reliable code to API: Call the standard Windows File Open/Save dialog box

    Igor

  8. #8
    Join Date
    Aug 2002
    Location
    Banbury, UK
    Posts
    7
    Originally posted by IGelin
    Hi,

    Here is some reliable code to API: Call the standard Windows File Open/Save dialog box

    Igor
    Cheers, but I gotta say, I've found this code in 3 or 4 places with the same comments rem'ed out in the same place, but in one of them I found a disclaimer saying written by ... authorised use only with disclaimer. Someones being a naughty boy/girl

    By the way, I'm working on adapting it - but I've found that if you use the code

    Forms![ImportTable]![File].Value = GetOpenFile

    this launches the open/dialog box window, and my whole code, to use a browse function in a combo box, is as follows - could someone check it and get back to me, as I'm not sure it will work on another computer - I tried on Access 97, and it didn't work there (I'm running 2000)

    Function Browse()

    Dim Data As Database, Rec As Recordset

    On Error Resume Next

    Set Data = CurrentDb
    Set Rec = Data.OpenRecordset("TableLocations", DB_OPEN_TABLE)


    If Forms![ImportTable]![File].Value = "Browse…" Then
    Forms![ImportTable]![File].Value = GetOpenFile
    Rec.AddNew
    Rec("FileName") = Forms![ImportTable]![File].Value
    Rec.Update
    Forms![ImportTable]![File].Requery
    End If

    Rec.Close
    Data.Close

    End Function

  9. #9
    Join Date
    Feb 2002
    Posts
    2,232
    Are you using either ms access 97 developer edition or ms office 97 developer edition ? Still, check under insert->activex controls -> ms common dialog control. Then use the following syntax in your code:

    CommonDialogX.ShowOpen

  10. #10
    Join Date
    Aug 2002
    Location
    Banbury, UK
    Posts
    7
    Originally posted by rnealejr
    Are you using either ms access 97 developer edition or ms office 97 developer edition ? Still, check under insert->activex controls -> ms common dialog control. Then use the following syntax in your code:

    CommonDialogX.ShowOpen
    I have got access 2000 neither office nor access developer edition, but I found the common dialog box control, clicked insert, and it popped up with "you don't have the liscence for this control!"


    So, that one not working then!

    Did you try the code on my form?

    You need a table called TableLocations with a field FileName with at least one entry, "Browse...", and a form called Form1 with a combo box called File on it.

    Try it and see if it works please

Posting Permissions

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