Solved

Set Value Macro Problem in Form - Setting Hyperlink field

Posted on 2011-03-08
2
927 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

813 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

15 Experts available now in Live!

Get 1:1 Help Now