|
-
Mar 20th, 2008, 07:27 AM
#1
Thread Starter
New Member
How to create a Hyperlink-column in an Access database table with VB6?
Hi,
I'm searching for some time now for code to create a hyperlink column in a table in an Access database, with Visual Basic 6 ( a column containing hyperlinks)
Creating other type of columns is no problem, e.g. Text columns, Date columns:
VB6 code:
Code:
Set MyDatabase = New ADODB.Connection
MyDatabase.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & TableName & ";" & "Persist Security Info=False"
MyDatabase.Open
MyDatabase.Execute "CREATE TABLE " & NewTableName & "(" & _
"ID HYPERLINK ," & _ (HYPERLINK gives a runtime error)
"ExpCode VARCHAR(50) ," & _ (creates a text column - works fine)
"Concerning MEMO ," & _ (creates a memo column - works fine)
"Date_ DATETIME )" (creates a date column - works fine)
VARCHAR(50), MEMO, DATETIME all create the type of column that I want, only HYPERLINK, or LINK, or HYPERLINKNAME... etc... (tried them all) do not create a hyperlink column but give errors.
I searched for hours but I just can't find it.
Is there any way to create a Hyperlink column with VB6-code?
Help will be greatly appreciated!
-
Mar 20th, 2008, 07:45 AM
#2
Frenzied Member
Re: How to create a Hyperlink-column in an Access database table with VB6?
I'm afraid not, no.
This site says you can't do it:
http://allenbrowne.com/func-DDL.html
-
Mar 20th, 2008, 09:07 AM
#3
Re: How to create a Hyperlink-column in an Access database table with VB6?
Store the link as straight text, and make it a hyperlink when you bring it out of the database and display it.
-
Mar 21st, 2008, 12:58 PM
#4
Thread Starter
New Member
Re: How to create a Hyperlink-column in an Access database table with VB6?
Thank you, PilgrimPete, I was already afraid it was not possible.
And thank you Hack, but you seem to have some kind of solution:
"Store the link as straight text, and make it a hyperlink when you bring it out of the database and display it."
What exactly do you mean with "bring it out of the database and display it" ?
So,the link as text could be something like:
"SomeLink#C:\Data\SomeDocument.doc"
How to display SomeLink as the link?
-
Mar 22nd, 2008, 07:26 AM
#5
Thread Starter
New Member
Re: How to create a Hyperlink-column in an Access database table with VB6?
By the way, is it possible in VB.Net?
-
Mar 28th, 2008, 06:44 PM
#6
Frenzied Member
Re: How to create a Hyperlink-column in an Access database table with VB6?
In C# there is a thing called a LinkLabel, I assume that VB has one too.
That will do what Hack suggests.
-
Mar 28th, 2008, 09:06 PM
#7
Re: How to create a Hyperlink-column in an Access database table with VB6?
With DAO, it looks like:
Code:
Set fldID = tdf.CreateField("ID", dbMemo)
fldID.Attributes = dbHyperlinkField + dbVariableField
tdf.Fields.Append fldID
Hyperlink is an attribute add to a Memo field, so Hyperlink field is actual a Memo field with a special attribute.
There is no Field Data Type called HYPERLINK:
Code:
Table Fields : Hyperlink
Query Parameters : Memo
Visual Basic : String
ADO Data Type property constants : adLongVarWChar
Microsoft Access database engine
SQL and synonyms : LONGTEXT (Synonyms: LONGCHAR, MEMO, NOTE)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|