Hyperlink address of value in field.

J

Jarryd

Hi,

I have the followin:

1 x table (tblTable) with 1 hyperlink field (hlnk) and 1 ID field (ID)
1 x form = frmForm
1 x command button on frmForm = btn
1 x textbox on frmForm bound to tblTable.ID = txtID
1 x textbox on frmForm bound to tblTable.hlnk = txtHlnk (isHyperLink)

When I click on btn it:
1.) creates a concatenated string comprised of a path (T:\Folder), value in
txtID and (.doc), e.g. "T:\Folder\1234.doc")
2.) creates a word document and saves it as the above string
3.) makes txtHlnk = string

All of it works but when I click on the value in txtHlnk it doesn't open the
document. If I manually type it in it works. If I open the table and
compare the values created by VBA and those entered manually I can see that
the address is blank for those created by VBA. So how do you set the
address for the value that will be entered into the underlying table.field,
tblTable.hlnk using VBA?

Private Sub btnGetNotes_Click()
Dim ID As String
Dim fname As String

po = Me.txtID
fname = "T:\Folder\" & po & ".doc"

Dim Create_Note As Object
Set Create_Note = CreateObject("Word.Application")
Create_Note.Documents.Add
Create_Note.ActiveDocument.SaveAs Filename:=fname
Create_Note.Quit
Set Create_Note = Nothing
txtHlnk = fname

TIA,

Jarryd
 

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