Results 1 to 9 of 9
  1. #1
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117

    Post Application.Followhyperlink works on one form not the other.

    Hello,

    I am using Access 2016. My database tracks training records. There is a form used to enter new training records. "frmInputTrng" I also have a form which is used to search for training records already entered. "frmSearchTrng"



    Both forms use control source of "tblTrngRecords". There is a text field used to store the file path to where the PDF of the signed training certificate is stored. "certLocation".

    On frmInputTrng, I have a button that opens the PDF - this was my simple solution to ensure the data entry personnel typed the right file path. If the pdf opens, then the file path is correct. The code is,
    HTML Code:
    Dim fileLocat As String
    fileLocat = Me.txtcertLocat.value
    Application.FollowHyperlink filelocat
    txtcertlocat = the text box on frmInputTrng where the filepath is entered by the user.
    This works great! However...

    On frmSearchTrng there is a continuous subform, "frmSearchSub" used to display the pertinent information on each record (Name, Date, Training Type, etc.). Also on frmSearchSub is a command button to open the pdf associated with that record.

    The code I am using is,
    HTML Code:
    Dim fileLocat as String
    fileLocat = Me.certlocation.value
    Application.FollowHyperlink filelocat
    The button is 'repeated' for each record as it is a continuous form. However, no matter which record I seek to open (click on) I get a Runtime Error 490.

    What confuses me even more is that an earlier iteration of the database (which as far as I can tell is exactly identical as far as the pertinent forms goes) this code is the same and it works fine.

    I have poured through the forum but cannot ascertain why the code works on one form and not the other. Or why it worked in an older iteration of the database (on the currently problematic form) but not now. Any ideas are greatly appreciated!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Weirdness is often due to corruption.

    If you import old form to newer db, does that imported form work?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by June7 View Post
    Weirdness is often due to corruption.

    If you import old form to newer db, does that imported form work?

    June - Sorry I should have mentioned that. I imported the old form and received the same runtime 490 error. I also tried the inverse (copied my dataset into the old database) and that did work. This leads me to believe the problem is not with my data (filepath) but with some aspect of the the current database.

    I have compact&repaired, restarted access, restarted computer - no change in result.

    Thanks.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    This is not a split db?

    Why not use the older version?

    There is a decompile/recompile process that sometimes helps weird issues. https://www.sourcedaddy.com/ms-acces...le-option.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by June7 View Post
    This is not a split db?
    No - Not a split DB.

    Why not use the older version?
    I inherited the older version. It was full of improper table/field names; bad relationships (trying to tie tables together with non-key fields); etc. I had limped along with that DB (adding the table and forms in use here). However, ultimately I had to accept that old version had too many issues for continued use so I started over from scratch importing only the table and the forms at issue here. Everything else in the new version really is new and had been working great, until this issue popped up.

    There is a decompile/recompile process that sometimes helps weird issues. https://www.sourcedaddy.com/ms-acces...le-option.html
    I will look into this and report back. Thank you for your ongoing assistance.
    EDIT: June - I performed the decompile/recompile operation with no change in state.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Have you tried on different computer?

    If you want to provide file for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    jtm013 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by June7 View Post
    Have you tried on different computer?
    If you want to provide file for analysis, follow instructions at bottom of my post.
    June - Issue is resolved. I am a dumb dumb.

    In an effort to make life easier for the data entry people I set up the "input" form so they only have to type "filename.pdf" and a before-update event adds the correct preliminary elements of the file path (C:\\etc\etc\etc). The Pdfs are stored in folders organized by department. I had the before-update event adding a preliminary file path that was identical regardless of which folder "filename.pdf" was actually stored in.

    "But you said it was working when the button was hit on the 'input' form" - Yes, yes I did.
    The code I listed in the OP wasn't the entire code (I know I know, I should have posted it exactly). Rather, I included a check to see if an entire file path had been typed rather than just "filename.pdf" If so, than the "open this pdf" button ignores the before-update appendment and just goes with the value in the text box.

    Guess what I was doing every time I 'tested' the "input" form?
    Yup, typing the entire file path rather than just the file name...thus negating my own typo.

    So all that to say - problem solved. My code is fine. But the data entry people are going to lose it when I tell them they have to reenter all ~4000 records that were effected.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Ouch!!

    Does each record have department identifier? Maybe you can modify stored path programmatically. If pathing can be built from other fields, there is no need to store entire path in one field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    jtm013 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by June7 View Post
    Ouch!!
    Does each record have department identifier? Maybe you can modify stored path programmatically. If pathing can be built from other fields, there is no need to store entire path in one field.
    June - Not directly. Department ID is a stored value under the employee's record in an employees table.
    However, now that I am looking at the data in the table the error doesn't look too bad. It looks like the last week data entry only did records for one department so while all ~4000 are wrong, they all need to be changed to the same thing. I decided to do the quick and dirty fix - export table to excel. delete all records that are correct. use 'find&replace' to change the folder name and import directly into the training records folder.

    Thanks again for your assistance!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. using FollowHyperlink
    By Jen0dorf in forum Modules
    Replies: 5
    Last Post: 11-24-2015, 04:30 PM
  2. Replies: 2
    Last Post: 06-25-2015, 01:40 PM
  3. Application.FollowHyperlink throwing Exception
    By Mnelson in forum Programming
    Replies: 4
    Last Post: 03-19-2015, 02:13 PM
  4. FollowHyperlink Help
    By RachelBedi in forum Access
    Replies: 6
    Last Post: 01-18-2013, 08:22 AM
  5. Replies: 0
    Last Post: 04-15-2010, 01:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums