Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using the Open or Browser Dialog box (Access 2000)

    I'd like to use the Open or Browse dialog box to locate files that will be entered in a hyperlink field. This is to save the user the trouble of typing in the name on path of the file to be stored.
    But I can't find how to reference either of those dialog boxes in VBA.
    Any suggestions?

    TIA

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

    Re: Using the Open or Browser Dialog box (Access 2000)

    The FileDialog was only introduced in Access 2002. I earlier versions, you must either use the Common Dialog Control, or use API functions. I have attached a zipped database (Access 97 format, but it should convert to Access 2000 without problems) with a class module that wraps the API function, and a form that demonstrates its use (I posted this at least twice before, but without the Search function...)

    Note: I didn't write the class module myself, although I modified it, but I don't know any more where I got it from originally.
    Attached Files Attached Files

  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using the Open or Browser Dialog box (Access 2000)

    Thanks - I'm looking at this right now. And since I posted I discovered:
    Application.RunCommand acCmdInsertHyperlink
    which calls up the Insert Hyperlink dialog, which would do just fine. Except I can not get it to run from a button! Arrgh!

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

    Re: Using the Open or Browser Dialog box (Access 2000)

    Two conditions must be satisfied to use RunCommand acCmdInsertHyperlink:

    1. You must have a text box bound to a hyperlink field.
    2. The focus must be on that text box. When you click a command button, that button has the focus. So you must set the focus to the text box before invoking RunCommand:

    Private Sub cmdHyperlink_Click()
    txtHyperlink.SetFocus
    RunCommand acCmdInsertHyperlink
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using the Open or Browser Dialog box (Access 2000)

    Brilliant!
    You were so fast with the answer, I didn't have time to post mine <img src=/S/grin.gif border=0 alt=grin width=15 height=15>.

    Thanks

Posting Permissions

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