Solved

Set Value Macro Problem in Form - Setting Hyperlink field

Posted on 2011-03-08
2
924 Views
Last Modified: 2012-06-21
I have a form that combines a [path], [item name] and [picture number].  From this field I want to set the value of a hyperlink field, which will open the picture.  I get an error code 2766, Object doesn't contain the Automation Object.."  I think it might be better to use VBA than the macro.

I would like to do two things with VBA.
1) Set the Value of the LinkText field to the Hyperlilnk field.
2) Change the name of a picture to the LinkText (minus the [path] value.
0
Comment
Question by:jmar6729
2 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 500 total points
ID: 35071964
I recommend to create a field e.g. Link and set its data type as Hyperlink.

Then on the Current Event of the form, put this code:

Private Sub Form_Current()
Me.Link = "#" & Me.Path & "/" & Me.FileName & "#"
End Sub


Link is the name of your field in your table
Path is the field name of your path
FileName is the field name of file name.

Sincerely,
Ed
0
 

Author Comment

by:jmar6729
ID: 35072660
Thanks, Ed.  That works great for the hyperlink.  Any idea how to use VBA to change the file name in the photo directory?  I have found and changed file names years ago but forget how to do that. (rst comes to mind :)

I will enter a [photonumber] into the form record.  Once I do that, the number is concatentated into the [photoname]. Then I need to rename the photo in the photo directory, so the hyperlink will work.

Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now