Hello All,
Ok I've read it is not necessarily a good ideal to create a hyperlink
field in a database, but I've tried. I've also read that a hyperlink
field is a memo field with attributes of dbHyperlinkField +
dbVariableField. So I tried using the code below, and received the error
below. Any ideals? Thanks!
,----- [ Error message on 'db.TableDefs.Append tdf' ]
| Run-time error '3010':
|
| Table 'Supplier' already exists.
`-----
=====================>Begin Code>===================================>
Sub CreateSuppliersWithHyperLink()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set db = CurrentDb()
Set tdf = db.CreateTableDef("Suppliers")
With tdf
.Fields.Append .CreateField("SupplierID", dbLong)
.Fields.Append .CreateField("CompanyName", dbText, 40)
.Fields.Append .CreateField("ContactName", dbText, 30)
.Fields.Append .CreateField("ContactTitle", dbText, 30)
.Fields.Append .CreateField("Address", dbText, 60)
.Fields.Append .CreateField("City", dbText, 15)
.Fields.Append .CreateField("Region", dbText, 15)
.Fields.Append .CreateField("PostalCode", dbText, 10)
.Fields.Append .CreateField("Country", dbText, 15)
.Fields.Append .CreateField("Phone", dbText, 24)
.Fields.Append .CreateField("Fax", dbText, 24)
.Fields.Append .CreateField("Homepage", dbMemo)
For Each fld In .Fields
If fld.name = "Homepage" Then
Debug.Print "ok your in the loop"
fld.Attributes = dbHyperlinkField + dbVariableField
End If
Next fld
End With
db.TableDefs.Append tdf
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
RefreshDatabaseWindow
End Sub
=====================<End Code<===================================<
--
Regards,
Greg Strong