Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set Value Macro Problem in Form - Setting Hyperlink field

Posted on 2011-03-08
2
Medium Priority
?
937 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

721 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