Networks Access 2003 VB Help, Please

Discussion in 'Hardware' started by Arthur2Sheds, 13 Jan 2006.

  1. Arthur2Sheds

    Arthur2Sheds Jackson

    Joined:
    19 May 2003
    Posts:
    817
    Likes Received:
    1
    I'm designing a very simple data entry form in MS Access 2003. The basic idea is that a data keyer can take an original document, key relevant information from that document into the form, and scan the document for later reference. The later reference part is what's causing me fits.

    When the data has been keyed and the documents imaged, a reviewer should be able to log into the form and press the shiny 'View Scanned Document' button I made. Right now the button doesn't do anything. I can figure out how to link to one image, but not how to link to an image based upon the data in the form.

    For instance, if the autonumber (Access-assigned primary key) is 42, I want to link to the image '42.tif', which is stored externally from the database (elsewhere on the network). The images are named by the person who scans the documents, according to the autonumber on their screen when they're entering the data.

    I know I need to use VB to do this. I don't know VB. Never used it before in my life. Where do I start? I found the VB coding screen in Access. And after frowning thoughtfully for thirty minutes or so, here I am.

    I'm not asking for anyone to write my code for me. I just need some useful references and tips from anyone who has done anything similar before.

    Thanks for the help!
     
  2. CaseyBlackburn

    CaseyBlackburn Network Techie

    Joined:
    27 Jul 2004
    Posts:
    1,846
    Likes Received:
    0
  3. Arthur2Sheds

    Arthur2Sheds Jackson

    Joined:
    19 May 2003
    Posts:
    817
    Likes Received:
    1
    You're right, I probably should've put this in Development. Oh, well, there's not that many people interested so it'll die in a couple of days anyway.

    Okay, I've made some progress. I'll post the code in case anybody else wants to beat their head in with Access! I stole the code from another application someone before me made and then modified it until it worked. I don't know how to properly insert comments in VB, so I'll just put mine in italics. Feel free to correct anything stupid I've done.

    So it works now, but it throws a warning about the potential dangers of launching a file outside of Access. After clicking OK, Windows pops up a message warning of pretty much the same thing in case I wasn't listening to Access. After another OK, the image opens and I'm a happy camper.

    All this brings me to my next question, which is how to stop those popups? Do they make a Google toolbar for Access?

    Yes, I was kidding, but any help is greatly appreciated.

    And if you read this far, I apologize for the boredom.

    Thanks.
     
  4. Arthur2Sheds

    Arthur2Sheds Jackson

    Joined:
    19 May 2003
    Posts:
    817
    Likes Received:
    1
    I've got it working now. The only part I had to add was a SendKeys command to simulate the user clicking on the OK button to dismiss the popups. The final code, with the SendKeys commands bolded, looks like this:
    The SendKeys command is pretty self-explanatory. It pretends the user hit the left arrow and then pressed enter. The '~' is just VB's special character for the enter button.

    One thing to note if you're attempting the same thing - The 'DoCmd.SetWarnings False' must come before the SendKeys commands. I don't know why, but if it comes after, you get three popups instead of the already annoying two.
     
Tags:

Share This Page