Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Hyperlink to specfic file

Discussion in 'Information Technology' started by Sailormike, Jul 28, 2006.

  1. Sailormike

    Sailormike
    Expand Collapse
    Guest

    I think I am using the wrong tool here. Pls advise.

    The app is land inventory for sales. Data is in several linked tables, all
    very conventional. I have form that displays data regarding a particular lot.
    I would like to have the user click on a button and open the contract for
    THAT SPECFIC LOT, not a contract document. Hyperlinks seen to want to go the
    same document no matter what record is current. I know i could make a table
    of documents and link on the contract # but it would be HUGH with all those
    graphics stored as records.

    What I was hoping for was a series of Word documents, one for each contract
    saved as "Contract 123, Contract 124, contract 125, etc." and then link each
    with the hyperlink so that if the user is on contract 123 and clicks the
    contract button they see Contract 123. Hyperlinks don't seen to work that way.

    Any suggestions would be appreciated.

    FYI, I know just enough VBA to be dangerous.
    SailorMike
     
  2. rico

    rico
    Expand Collapse
    Guest

    Yes your not quite there but on the right track.

    I would create a normal button on your form with some code like so, where
    "filelocation" is the name of the field that contains the full filename of
    the contract you want to open:

    Dim str as string

    str = me.filelocation

    followhyperlink str


    HTH

    Rico

    "Sailormike" wrote:

    > I think I am using the wrong tool here. Pls advise.
    >
    > The app is land inventory for sales. Data is in several linked tables, all
    > very conventional. I have form that displays data regarding a particular lot.
    > I would like to have the user click on a button and open the contract for
    > THAT SPECFIC LOT, not a contract document. Hyperlinks seen to want to go the
    > same document no matter what record is current. I know i could make a table
    > of documents and link on the contract # but it would be HUGH with all those
    > graphics stored as records.
    >
    > What I was hoping for was a series of Word documents, one for each contract
    > saved as "Contract 123, Contract 124, contract 125, etc." and then link each
    > with the hyperlink so that if the user is on contract 123 and clicks the
    > contract button they see Contract 123. Hyperlinks don't seen to work that way.
    >
    > Any suggestions would be appreciated.
    >
    > FYI, I know just enough VBA to be dangerous.
    > SailorMike
     
  3. Ken Sheridan

    Ken Sheridan
    Expand Collapse
    Guest

    You don't need to store the documents as embedded objects in a table, simply
    the paths to the files in a text field. You can then use the FollowHyperlink
    method in the button's Click event procedure to open the document associated
    with the current record. Other possible ways would be to call the VBA Shell
    function, or the Windows API ShellExecute function to open the file.
    Assuming the documents are Word files you could also use automation to open
    the document.

    Ken Sheridan
    Stafford, England

    "Sailormike" wrote:

    > I think I am using the wrong tool here. Pls advise.
    >
    > The app is land inventory for sales. Data is in several linked tables, all
    > very conventional. I have form that displays data regarding a particular lot.
    > I would like to have the user click on a button and open the contract for
    > THAT SPECFIC LOT, not a contract document. Hyperlinks seen to want to go the
    > same document no matter what record is current. I know i could make a table
    > of documents and link on the contract # but it would be HUGH with all those
    > graphics stored as records.
    >
    > What I was hoping for was a series of Word documents, one for each contract
    > saved as "Contract 123, Contract 124, contract 125, etc." and then link each
    > with the hyperlink so that if the user is on contract 123 and clicks the
    > contract button they see Contract 123. Hyperlinks don't seen to work that way.
    >
    > Any suggestions would be appreciated.
    >
    > FYI, I know just enough VBA to be dangerous.
    > SailorMike
     
  4. Sailormike

    Sailormike
    Expand Collapse
    Guest

    Thanks, Ken. I am not sure just how to do what u suggested but maybe that F1
    key will help. I am not familiar with FollowHyperLink, didn't know it
    existed. But that does sound like the right approach.

    Thanks for steering me in the right direction.
    --
    SailorMike


    "Ken Sheridan" wrote:

    > You don't need to store the documents as embedded objects in a table, simply
    > the paths to the files in a text field. You can then use the FollowHyperlink
    > method in the button's Click event procedure to open the document associated
    > with the current record. Other possible ways would be to call the VBA Shell
    > function, or the Windows API ShellExecute function to open the file.
    > Assuming the documents are Word files you could also use automation to open
    > the document.
    >
    > Ken Sheridan
    > Stafford, England
    >
    > "Sailormike" wrote:
    >
    > > I think I am using the wrong tool here. Pls advise.
    > >
    > > The app is land inventory for sales. Data is in several linked tables, all
    > > very conventional. I have form that displays data regarding a particular lot.
    > > I would like to have the user click on a button and open the contract for
    > > THAT SPECFIC LOT, not a contract document. Hyperlinks seen to want to go the
    > > same document no matter what record is current. I know i could make a table
    > > of documents and link on the contract # but it would be HUGH with all those
    > > graphics stored as records.
    > >
    > > What I was hoping for was a series of Word documents, one for each contract
    > > saved as "Contract 123, Contract 124, contract 125, etc." and then link each
    > > with the hyperlink so that if the user is on contract 123 and clicks the
    > > contract button they see Contract 123. Hyperlinks don't seen to work that way.
    > >
    > > Any suggestions would be appreciated.
    > >
    > > FYI, I know just enough VBA to be dangerous.
    > > SailorMike

    >
     
  5. Sailormike

    Sailormike
    Expand Collapse
    Guest

    Sorry but I can't get this procedure to work. I either go the same document
    every time or nowhere at all. I tried creating a hyperlink field in the table
    and inserting the address there but it only work on my W/S. Everyone else
    gets an error messge "Can't open specfied file" and the reason for that is
    the path is not correct from any W/S but mine. Obviously I can't create 12
    different paths every time we add a document so HOW do i get to a particular
    document from the current record. I am seriously thinking of making that
    table after all. THAT i know will work.

    SailorMike


    "Sailormike" wrote:

    > Thanks, Ken. I am not sure just how to do what u suggested but maybe that F1
    > key will help. I am not familiar with FollowHyperLink, didn't know it
    > existed. But that does sound like the right approach.
    >
    > Thanks for steering me in the right direction.
    > --
    > SailorMike
    >
    >
    > "Ken Sheridan" wrote:
    >
    > > You don't need to store the documents as embedded objects in a table, simply
    > > the paths to the files in a text field. You can then use the FollowHyperlink
    > > method in the button's Click event procedure to open the document associated
    > > with the current record. Other possible ways would be to call the VBA Shell
    > > function, or the Windows API ShellExecute function to open the file.
    > > Assuming the documents are Word files you could also use automation to open
    > > the document.
    > >
    > > Ken Sheridan
    > > Stafford, England
    > >
    > > "Sailormike" wrote:
    > >
    > > > I think I am using the wrong tool here. Pls advise.
    > > >
    > > > The app is land inventory for sales. Data is in several linked tables, all
    > > > very conventional. I have form that displays data regarding a particular lot.
    > > > I would like to have the user click on a button and open the contract for
    > > > THAT SPECFIC LOT, not a contract document. Hyperlinks seen to want to go the
    > > > same document no matter what record is current. I know i could make a table
    > > > of documents and link on the contract # but it would be HUGH with all those
    > > > graphics stored as records.
    > > >
    > > > What I was hoping for was a series of Word documents, one for each contract
    > > > saved as "Contract 123, Contract 124, contract 125, etc." and then link each
    > > > with the hyperlink so that if the user is on contract 123 and clicks the
    > > > contract button they see Contract 123. Hyperlinks don't seen to work that way.
    > > >
    > > > Any suggestions would be appreciated.
    > > >
    > > > FYI, I know just enough VBA to be dangerous.
    > > > SailorMike

    > >
     
  6. Ron2006

    Ron2006
    Expand Collapse
    Guest

    Here is an example of what can be done.

    1) if the directory where your tables mdb is stored is:
    V:/ourApplication/

    2)then create a sub directory such as
    V:/ourApplication/Contracts/
    The key is that the directory where the contracts are kept MUST be
    accessable by everyone and one place to do that is in the same relative
    location as your application.

    3) have a button that will be used to find the contract. in the onclick
    event write

    strfilelocation = "V:/ourApplication/Contracts/" &
    me.contractIdentification

    Application.FollowHyperlink strfilelocation, , True


    me.contractIdentification is whatever field you indicated
    above that contains "Contract 123" etc .

    Ron
     
  7. Ron2006

    Ron2006
    Expand Collapse
    Guest


    > strfilelocation = "V:/ourApplication/Contracts/" &
    > me.contractIdentification
    >


    This should be modified to include the suffix for the document type.
    For instance if it was a word document it would probably be something
    like.

    strfilelocation = "V:/ourApplication/Contracts/" &
    me.contractIdentification & ".doc"


    watch for word wrape here on the posting.
     
  8. Sailormike

    Sailormike
    Expand Collapse
    Guest

    Thanks Ron. I've been playing with this all AM and haven't had much luck. I
    tried adding a hyperlink field to the table and storing the path there but
    while it works fine on my W/S when i open the linked table on another W/S the
    path defaults to the local drive. It actually overwrites the path i stored in
    the table on the server. So that it not only does it not work there, on that
    W/S, but now will not work anywhere.

    I will try your idea, mine is certainly not going anywhere.
    --
    SailorMike


    "Ron2006" wrote:

    >
    >
    > > strfilelocation = "V:/ourApplication/Contracts/" &
    > > me.contractIdentification
    > >

    >
    > This should be modified to include the suffix for the document type.
    > For instance if it was a word document it would probably be something
    > like.
    >
    > strfilelocation = "V:/ourApplication/Contracts/" &
    > me.contractIdentification & ".doc"
    >
    >
    > watch for word wrape here on the posting.
    >
    >
     
  9. Ron2006

    Ron2006
    Expand Collapse
    Guest

    Sailormike,

    I don't want to confuse the matter, but one other thing may come into
    play and you will have to judge how you want to handle it, although you
    may be forced to use it IF the documents are not kept on the same drive
    as your application.

    This deals with using UNC drive mapping instead of letter drive
    mapping. IF the contracts are kept on a drive different than you
    application AND not everyone has that directory mapped to the same
    drive, you will obviously have some problems. In that case you will
    have to use UNC drive mapping instead. It is slightly slower than
    letter mapping but gets around the different letter problem.

    Instead of saying that the stored directory is:
    strfilelocation = "V:/ourApplication/Contracts/" &
    me.contractIdentification & ".doc"

    you will express it as follows:

    strfilelocation = "\\myserver\myshare\ourApplication\Contracts\" &
    me.contractIdentification & ".doc"

    This part of the address makes it a UNC mapping.
    "\\myserver\myshare\" - This is what the letter corresponds
    with.

    Your network people can supply you with the value for the ."Myserver"
    and the "myshare" part. Tell them you need to know the UNC mapping to
    get to the proper drive/folder.

    Sometimes you can guess at it by looking at the drive mappings in the
    "My Computer" window on your computer, sometimes not.

    Ron
     
  10. Sailormike

    Sailormike
    Expand Collapse
    Guest

    Ron:
    You got that right!

    The app is split. The tables are on the server and each W/S has a GUI with
    tables linked to that server. The actual path is \\server\common
    shared\documents\123_contract_Buy.doc.

    The idea here was to eliminate the “Go get me the file on Smith while this
    guy is on the phone†problem. They are planning to scan in contracts, plat
    maps, HUD statements, etc. so they can bring up the relevant document w/o
    getting the paper file.

    It was working when I left but I’ve had it working before only to have it
    lose those links and default to C:\common shared\documents, etc. Tomorrow
    will tell.?!

    I appreciate your taking the time to help me with this. I have done a few
    simple apps in Access before but this linking to documents is new to me.

    BTY, In this little office I AM the on site “network peopleâ€. Scary ain’t it!

    --
    SailorMike


    "Ron2006" wrote:

    > Sailormike,
    >
    > I don't want to confuse the matter, but one other thing may come into
    > play and you will have to judge how you want to handle it, although you
    > may be forced to use it IF the documents are not kept on the same drive
    > as your application.
    >
    > This deals with using UNC drive mapping instead of letter drive
    > mapping. IF the contracts are kept on a drive different than you
    > application AND not everyone has that directory mapped to the same
    > drive, you will obviously have some problems. In that case you will
    > have to use UNC drive mapping instead. It is slightly slower than
    > letter mapping but gets around the different letter problem.
    >
    > Instead of saying that the stored directory is:
    > strfilelocation = "V:/ourApplication/Contracts/" &
    > me.contractIdentification & ".doc"
    >
    > you will express it as follows:
    >
    > strfilelocation = "\\myserver\myshare\ourApplication\Contracts\" &
    > me.contractIdentification & ".doc"
    >
    > This part of the address makes it a UNC mapping.
    > "\\myserver\myshare\" - This is what the letter corresponds
    > with.
    >
    > Your network people can supply you with the value for the ."Myserver"
    > and the "myshare" part. Tell them you need to know the UNC mapping to
    > get to the proper drive/folder.
    >
    > Sometimes you can guess at it by looking at the drive mappings in the
    > "My Computer" window on your computer, sometimes not.
    >
    > Ron
    >
    >
     
  11. Ron2006

    Ron2006
    Expand Collapse
    Guest

    I wonder if it is a windows default thing. I know that on many apps the
    program will save the last directory that I saved items in so that when
    I try to save another record it goes back to that directory. If however
    that directory is not available it then will default back to my
    documents.
    Has something changed, perhaps so that the directory it was going to
    has changed, so the hard coded directory you have in the program can't
    be found so it is defaulting to my documents.? That would explain at
    one time worked and now does not.

    Ron
     

Share This Page