Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command Button Advice (Access 2003)

    Hello!

    I am trying to create a command button that would call up a scanned document from a specified file path. When pushing the button I would like access to call up the Word document for a specific record from a common folder. Any ideas on how to code something like that?

    Thanks!

    D

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

    Re: Command Button Advice (Access 2003)

    Welcome to Woody's Lounge!

    Without knowing the details, it's hard to give specific advice. Let's say that the file name is in a text box named txtFilename on your form (it can be bound to a field in the record source of the form). The On Click event handler for the command button could look like this:

    Private Sub cmdOpenDoc_Click()
    Application.FollowHyperlink "C:ScannedFiles" & Me.txtFilename
    End Sub

    where cmdOpenDoc is the name of the command button, and C:ScannedFiles is the path for the scanned files.

  3. #3
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Button Advice (Access 2003)

    Hans,

    This code worked great! Now when I push the command button the file that I want appears!!

    Thanks for the help!

    Dave O.

  4. #4
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Button Advice (Access 2003)

    Hans,

    How do you handle the text box if there is no document file present? When I run the command button Access opens up the path directory to the folder. I would like to code the button to end its procedure if there is nothing in the text box.

    Thanks!

    Dave O.

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

    Re: Command Button Advice (Access 2003)

    You could handle it like this, using the same names as in my previous reply:

    Private Sub cmdOpenDoc_Click()
    If IsNull(Me.txtFilename) Then Exit Sub
    Application.FollowHyperlink "C:ScannedFiles" & Me.txtFilename
    End Sub

  6. #6
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Button Advice (Access 2003)

    Hans,

    That worked beautifully. Thanks again for the help!

    Dave O.

Posting Permissions

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