简体   繁体   English

如何在MS Access表中找到列的类型?

[英]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. 使用内部工具并尝试找出使用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! 谢谢!

You can use the type property of the field you want to examine. 您可以使用要检查的字段的type属性。 Here is a link with all data types: http://msdn.microsoft.com/en-us/library/office/ff845405.aspx 这是所有数据类型的链接: http : //msdn.microsoft.com/zh-cn/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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM