Can't create hyperlink with ADOX
Dave_at_LAD
Date: 09/24/04
- Next message: William \(Bill\) Vaughn: "Re: I need a good book or two on ADO"
- Previous message: MichaelZeno: "System.Data.DBConcurrencyException"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 13:25:04 -0700
Hello all!
I need to programmatically create an Access mdb with a table that has a
hyperlink field using VB script.
I understand that do this I create a field with data type adLongWVarChar and
Column provider specific property Jet OLEDB:Hyperlink=Yes.
The code below fails and reports Test.vbs <20, 1> ADOX.Tables: Item cannot
be found in the collection corresponding to the requested name or ordinal.
Comment out the ".Columns("Hyperlink").Properties" line and the code
completes without error but the field is a memo not a hyperlink.
Does anyone have suggestions?
'Test.vbs
Const adLongWVarChar = 203'Memo or Hyperlink
Const adColNullable = 2 'The column may contain null values.
'Create DB
Dim cat
Set cat=CreateObject("ADOX.Catalog")
cat.Create "Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='Test.mdb'"
'Create Table1
Dim tbl
Set tbl=CreateObject("ADOX.Table")
Set tbl.ParentCatalog = Cat
With tbl
.Name = "Table1"
'Create Column Hyperlink
.Columns.Append "Hyperlink", adLongWVarChar
.Columns("Hyperlink").Attributes=adColNullable
.Columns("Hyperlink").Properties("Jet OLEDB:Hyperlink")=Yes'<=works commented
End With
cat.Tables.Append tbl' add table to DB
- Next message: William \(Bill\) Vaughn: "Re: I need a good book or two on ADO"
- Previous message: MichaelZeno: "System.Data.DBConcurrencyException"
- Messages sorted by: [ date ] [ thread ]