Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 3rd, 2004, 08:01 AM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to retrive the column properties

ok
 
Old December 3rd, 2004, 12:13 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to retrive PurchaseOrderNumber attribute LeoMathew XSLT 2 September 4th, 2008 08:17 AM
how to retrive image from database gaurav gupta ASP.NET 2.0 Professional 1 July 21st, 2008 10:44 AM
retrive images from a database vindya0121 VB Databases Basics 0 March 23rd, 2006 07:30 AM
How do i retrive login name drachx General .NET 6 October 7th, 2004 07:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.