Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / January 2006

Tip: Looking for answers? Try searching our database.

Hyperlink walkthrough

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jodyblau - 30 Jan 2006 06:32 GMT
I am trying to go through a list of files in a folder and then add a
hyperlink to each one in a table.

I am having a difficult time figuring out how to add that link into the
table and do it in such a way that the entire path isn't displayed in
the record, just the document name (just like I can make it look if I
add the hyperlink by hand and then edit it using the dialog.)

I have tried figuring it out using this article: (but I still don't get
it)
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/u
singhyperlinksinmicrosoftaccessapplications.asp


Could someone kindly walk me through how to get from having a String
with my file path stored in it, to adding it to my table, such that the
link only displays the document name and not the full path?

Thank you,

Jody Blau
Terry Kreft - 30 Jan 2006 11:20 GMT
It would be easier to makit specific for you if we knew your table tructure
but here's an example which will hopefully make som sense.

The table structure I used or this example was
tlHyperLink
---------------
Name    DataType
ID         AutoNumber
File        Hyperlink

The following actually adds the value to th table:-

Sub AddHyperLink( _
   Tablename As String, _
   FieldName As String, _
   Hyperlink As String, _
   DisplayText As String _
)
   Dim db As DAO.Database
   Dim strValue As String
   Dim strSQl As String

   Const ELEMENT_SEP = "#"

   If Len(DisplayText) < 1 Then
       DisplayText = Hyperlink
   End If

   strValue = DisplayText & ELEMENT_SEP & Hyperlink & ELEMENT_SEP

   strValue = Replace(strValue, "'", "''", Compare:=vbTextCompare)

   strSQl = "INSERT INTO [" & Tablename & "] ([" _
          & FieldName & "]) VALUES ('" _
          & strValue & "')"

   CurrentDb.Execute strSQl
End Sub

The following is an example of adding the entire contentsof a folder

Function wut()
   Dim strFile As String
   Const FOLDER_PATH = "D:\Projects\Pinnacle\Tools\Automation
Wizard\Audit\"

   strFile = Dir(FOLDER_PATH & "*.txt")
   Do While Len(strFile) > 0
       Call AddHyperLink("tlHyperLink", "File", FOLDER_PATH & strFile,
strFile)
       strFile = Dir
   Loop
End Function

If you have one filename you could do the folloing
   Call AddHyperLink("tlHyperLink", "File", YourFileName,
Dir(YourFileName))

Signature

Terry Kreft

> I am trying to go through a list of files in a folder and then add a
> hyperlink to each one in a table.
[quoted text clipped - 6 lines]
> I have tried figuring it out using this article: (but I still don't get
> it)

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/u
singhyperlinksinmicrosoftaccessapplications.asp


> Could someone kindly walk me through how to get from having a String
> with my file path stored in it, to adding it to my table, such that the
[quoted text clipped - 3 lines]
>
> Jody Blau
jodyblau - 31 Jan 2006 01:49 GMT
That worked great, thank you so much.

Jody Blau
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.