|
Criando campos hyperlink por código |
(P) Não consigo criar um campo Hyperlink em uma tabela por meio de código. Quais os passos necessários se isso é possível? |
(R) Para criar um campo do tipo hyperlink, seus Atributos devem estar como dbHyperlinkField. Experimente esta função como exemplo:
'****************** Início do Código ******************* ' Este código foi escrito originalmente por Dev Ashish. ' Ele não deve ser alterado ou distribuído, ' exceto como parte de um aplicativo. ' Use-o livremente em seu aplicativo, ' desde que esta nota de copyright não seja alterada. ' ' Código cortesia de ' Dev Ashish ' ' Function fTableWithHyperlink(stTablename As String) As Boolean On Local Error GoTo fTableWithHyperlink_Err Dim Msg As String ' for error handling Dim db As Database Dim tdf As TableDef Dim fld As Field Set db = CurrentDb Set tdf = db.CreateTableDef(stTablename) Set fld = tdf.CreateField("HyperlinkTest", dbMemo) fld.Attributes = dbHyperlinkField tdf.Fields.Append fld tdf.Fields.Refresh db.TableDefs.Append tdf db.TableDefs.Refresh Set fld = Nothing Set tdf = Nothing Set db = Nothing fTableWithHyperlink = True fTableWithHyperlink_End: Exit Function fTableWithHyperlink_Err: fTableWithHyperlink = False Msg = "Informação de erro..." & vbCrLf & vbCrLf Msg = Msg & "Função: fTableWithHyperlink" & vbCrLf Msg = Msg & "Descrição: " & Err.Description & vbCrLf Msg = Msg & "Erro Nº: " & Format$(Err.Number) & vbCrLf MsgBox Msg, vbInformation, "fTableWithHyperlink" Resume fTableWithHyperlink_End End Function '****************** Final do Código******************* |