Here is some code to get you started:
This Sub Procedure will list all columns in the database with the table name, column name and datatype. From what I have been able to see: 130 is Text, 3 is a Number, 7 is a Date and 11 is a Yes/No Field.
I would think that you could insert some code to check for the table name and the column name and then retrieve the datatype to whichever column you need.
Sub ListDataType()
Dim cnnDB As ADODB.Connection
Dim rstList As ADODB.Recordset
Set cnnDB = Application.CurrentProject.Connection
Set rstList = cnnDB.OpenSchema(adSchemaColumns)
With rstList
Do While Not .EOF
Debug.Print .Fields("Table_Name") & vbTab & .Fields("Column_Name")
Debug.Print .Fields("Data_Type")
.MoveNext
Loop
End With
cnnDB.Close
Set cnnDB = Nothing
End Sub
Mike
EchoVue.com
|