We help IT Professionals succeed at work.

modify the URL of a hyperlink field on a drag and drop?

Gary Samuels
Gary Samuels asked
Last Modified: 2008-04-24
For years I've used an Access database to record purchases. I have a purchase order form which holds all the information about a purchase. The form includes one field which is setup as a "Hyperlink" data type. I can scan a receipt, save it as a PDF file and then drag the file to the Hyperlink field on the Access form.  The local URL is automatically filled into the field and everything works great. Anyone on my local network can open a purchase order and by clicking the Hyperlink field the PDF file will open in a browser and they can see the original receipt.

Someone from a different office called me and asked about a purchase so I opened the database form, found the record pertaining to the purchase and printed the selected record as a PDF with the intent to mail it to them.  I noticed as I viewed the PDF (purchase order) in Acrobat Reader I was still able to click the Hyperlink field and the receipt would open in a browser.  So I manually edited the hyperlink address, in my access form, and changed it to fully qualified URL such as: http://companyServer.com/receipt/test.pdf and it also works across the internet. (Of course I did some IIS stuff to set it up).

Finally to my question...When I drop a file on the Hyperlink control, how can I get the Hyperlink field to automatically change from:    \\myserver\receipts\test.pdf    to    http://companyServer.com/receipts/test.pdf?
If I can get this to work I'll never have to turn in another receipt. I'll just email my purchase orders in as a PDF and they can click the hyperlink to see the original receipt. Any help would be greatly appreciated.
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
Gary SamuelsPlant Manager


Looks like that would update all the current records in my table, which I need to do. But, I was asking about how to change the URL on a drag and drop. That is, each time I create a new record I don't want to have to manually change the field or run an update query.

If your trying to tell me how to create a macro or write the code that will execue on the drag and drop I'm not really following you?

What's the code for the drag and drop?
This one is on us!
(Get your first solution completely free - no credit card required)
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

AFAIK, Access doesn't respond to the "drag" or "drop" event ... so you can't really do anything when you Drop something onto an Access form. You might be able to do something with the GotFocus or Enter event of a textbox, but those are unreliable (and I doubt you want the code to fire in either of those events).

If you're using a third party control/code to do this, then perhaps you could do something in that code.
Gary SamuelsPlant Manager


bluelizard, Thanks for the help. I haven't had the chance to try it yet but I'm sure I make something work. At the very least, if the After_Update routine doesn't work with the drag and drop I can fire the event from a command button. So after the drag and drop I only need to click a button to reformat the field.

Jerryb30, thanks for the code I will need to update my table and breaking a string apart to pluck out some of the text is not something I could do of the top of my head.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.