Listing out Hyerplinks

R

Roger Carlson

In order to make your hyperlink active, you have to add pound signs (#)
around the string:
Me.txtDocs = "#" & DocPath & "#"

where DocPath is a string that holds the path to the file.

No, there is no AddItem method to the Access Combobox. Combo box Row Source
is set in the Row Source property with a SQL statement.

If fact, I don't think you can have active hyperlinks in a List or Combo
box. I've always done it with a form or subform in Continuous View.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
G

Garth Wells

What is the easiest way to display a list of hyperlinks on a form. I
created a hyperlink field and populated a comb box with the values,
but the documents are not opened when selected a value is selected
from the combo box.

Also, is there a way to set the Hyperlink property in code for a list?
Something like...

--
If rs.EOF = False Then
While Not rs.EOF
Combo11.AddItem rs(4)
' Combo11.HyperlinkAddress = "c:\worddoc1.doc"
rs.MoveNext
Wend



Thanks for your help
 
G

Garth Wells

In order to make your hyperlink active, you have to add pound signs (#)
around the string:
Me.txtDocs = "#" & DocPath & "#"

where DocPath is a string that holds the path to the file.

No, there is no AddItem method to the Access Combobox. Combo box Row Source
is set in the Row Source property with a SQL statement.

If fact, I don't think you can have active hyperlinks in a List or Combo
box. I've always done it with a form or subform in Continuous View.

Thanks for the response.

I don't want to appear to be too ignorant, but I only work with Access
once or twice a year and have no idea how to retrieve a list of the hyperlinks
and place them on a form.

I would like to explain the problem in ASP terms and get an analogous
solution for Access. Assume you have a table called Documents, and it
has the following columns:

Doc_ID
Doc_Name
Doc_FileName
Doc_Type

and you want to be able to list all documents of a certain type, and make
them accessible via a hyperlink. Further, assume that each Doc_Type is
going to point to base directory. Using T-SQL, I would write a stored
procedure that does the following:

CREATE PROCEDURE pr_Documents_SelectByType
@Doc_Type varchar(10)
AS
SELECT CASE
WHEN DOC_Type='A' THEN '<a
href=C:\A\'+Doc_FileName+'>'+Doc_Name+'</a>'
WHEN DOC_Type='B' THEN '<a
href=C:\B\'+Doc_FileName+'>'+Doc_Name+'</a>'
END AS URL
FROM Documents
WHERE Doc_Type=@Doc_Type

I'm dynamically building the URL because I know a certain type points to a
subdirectory,
and this will allow the user to only type in the filename.

I would then call the procedure with a parameter and write the resultset using a
Do While !rs.EOF. Of course with .Net this gets even easier because you can
use a datalist or datagrid to list out the data.

If you could help me accomplish the same thing in Access 2003 I would be
grateful.
 
G

Garth Wells

Thanks for your help. Before you replied back a colleague helped me too.

I ended up using the following to populate a list box...hiding the first column.

SELECT "C:\BaseDirectory\"+Categories.CA_Name+"\"+Documents.DO_FileName AS URL,
Documents.DO_Name
FROM (Documents INNER JOIN DocumentKeywords ON
Documents.DO_ID=DocumentKeywords.DO_ID)
INNER JOIN Categories ON Documents.CA_ID1=Categories.CA_ID
WHERE (((DocumentKeywords.DK_Description)=Forms!KeywordSearch!Keyword));

And put this in the OnClick event of the list box.

Application.FollowHyperlink ListResults.ItemData(ListResults.ListIndex)


It seems to work well.

Thanks again for the help.

Garth
 

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