Lista de campos de una tabla access
440
post-template-default,single,single-post,postid-440,single-format-standard,ajax_fade,page_not_loaded,,vertical_menu_enabled,qode-title-hidden,side_area_uncovered_from_content,qode-theme-ver-11.0,qode-theme-bridge,wpb-js-composer js-comp-ver-5.0.1,vc_responsive

Lista de campos de una tabla access

Modo resumido

Sub CamposDeTabla1()
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Set dbs = OpenDatabase("i:\intex winbol2000\E999\car.mdb")
    Set tdf = dbs.TableDefs("CART0001")
    For Each fld In tdf.Fields
        Debug.Print fld.Name
    Next
    Set fld = Nothing
    Set tdf = Nothing
    dbs.Close
End Sub

Modo ampliado

Sub CamposDeTabla()
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Set dbs = OpenDatabase("i:\intex winbol2000\E999\car.mdb")
    Set tdf = dbs.TableDefs("CART0001")
    For Each fld In tdf.Fields
        Select Case fld.Type
            Case 1 ' Boolean
                Debug.Print fld.Name
            Case 4 ' Long
                Debug.Print fld.Name
            Case 7 ' Double
                Debug.Print fld.Name
            Case 8 ' Date
                Debug.Print fld.Name
            Case 10 ' Text
                Debug.Print fld.Name
            Case 12 ' Memo
                Debug.Print fld.Name
            Case Else
                Debug.Print fld.Name
        End Select
    Next
    Set fld = Nothing
    Set tdf = Nothing
    dbs.Close
End Sub
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5,00 out of 5)
Cargando…
Tags:
No Comments

Deja un comentario

Uso de cookies

Este sitio web utiliza cookies para que usted tenga la mejor experiencia de usuario. Si continúa navegando está dando su consentimiento para la aceptación de las mencionadas cookies y la aceptación de nuestra política de cookies, pinche el enlace para mayor información.plugin cookies

ACEPTAR
Aviso de cookies