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))
--
Terry Kreft
"jodyblau" <jo******@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
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/de...plications.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