Andrew Kogler
Andrew Kogler

Reputation: 51

How can I find the type of a column in an MS Access table?

working on an internal tool and trying to find out how I could see the type of a column in a table while using MS Access. I need to know the types so that I can better handle the issue when I am comparing identical column captions but different types. Thanks!

Upvotes: 0

Views: 121

Answers (1)

Luke Wage
Luke Wage

Reputation: 703

You can use the type property of the field you want to examine. Here is a link with all data types: http://msdn.microsoft.com/en-us/library/office/ff845405.aspx

And a code snippet to get you started.

Option Compare Database
Option Explicit

Sub GetTypes()
    Dim d As Database
    Set d = CurrentDb

    Dim t As TableDef
    Set t = d.TableDefs("Table1")

    Dim f As Field
    For Each f In t.Fields
        Debug.Print f.Name & " " & f.Type
    Next f
    Set f = Nothing

    Set t = Nothing
    Set d = Nothing
End Sub

Upvotes: 1

Related Questions