Solved

Set Value Macro Problem in Form - Setting Hyperlink field

Posted on 2011-03-08
2
934 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

617 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