Error 438 when trying to assign hyperlink value to fiield using DAO

M

Mark A. Sam

Hello,

In the snippet below I am trying to assign a hyperlink variable to a field
using DAO, but get erro 438:Object doesn't support this property or method.

[txtDoc] is a hypelink value on a form textbox. [Doc] is a hyperlink field
in table Docs.

The error occurs at:

rst![Doc] = hypDoc


'Add hyperlink to Docs table
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Docs", dbOpenDynaset)
Dim hypDoc As Hyperlink
Set hypDoc = [txtDoc].Hyperlink

rst.AddNew
rst![Doc] = hypDoc
rst.Update

Thanks for any help and God Bless,

Mark A. Sam
 
M

Mark A. Sam

Rob,

Instead of assigning the hyperlink to a variable I assigned to a field on
the form. I have since solved the original problem by using the
HyperlinkPart method (helpdescription is below).

Microsoft#http://www.microsoft.com#

acDisplayedValue: Microsoft


acDisplayText: Microsoft

acAddress: http://www.microsoft.com

acSubAddress:

acScreenTip:

acFullAddress: http://www.microsoft.com


Here is a code snippet from a procedure I just wrote: The last row assigns
the hyperlink.

With Application.FileSearch
.LookIn = "D:\_ScannedDocsDev"
.FileName = "*.pdf"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
strDoc = .FoundFiles(i)
If Right(strDoc, 4) = ".pdf" Then
strDisplay = Mid(StrReverse([strDoc]), 5, 9) 'Parse out the load
number from the file name
strDisplay = StrReverse(strDisplay) 'After parsing the load
number is reversed and needs to be reversed again to read correctly
rst.AddNew
rst![docID] = i 'Not using autonumber to allow deleting without
it incrementing to a huge number
rst![Doc] = strDisplay & "#" & .FoundFiles(i) & "#"

strDisplay is what will display in the textbox.
..FoundFiles(i) is that path and file that will be stored in the hyperlink
field. In my case is it a path to a file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top