Wrox Programmer Forums
|
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 January 17th, 2006, 02:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Types

When I ran the following module:

Sub GetFields()
Dim tbl As TableDef
Dim fld As Field
Dim TableToProcess As String
TableToProcess = InputBox("Enter table get fields list:")
For Each tbl In CurrentDb().TableDefs
    If tbl.Name = TableToProcess Then
        For Each fld In tbl.Fields
            Debug.Print fld.Name; fld.Type
        Next fld
    End If
Next tbl
End Sub

I expected the DataType to come out with something like:

dbText
dbDouble

But instead I get a series of integers representing these. Is it possible to get what I want. Any help/replies much appreciated. Thanks.

Clive Astley
__________________
Clive Astley
 
Old January 17th, 2006, 04:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Clive,

You have to do a lot of this sort of thing to output string desctiptions of enum values:

'================================================= ====================
' OutputConstantDescriptions Function
' --------------------------
' Evaluates long constant values and outputs corresponding string
' description.
'
' Param Use
' ------------------------------------------------
' lngCursorLocation Value of constant in the
' ADODB.CursorLocationEnum.
' lngCursorType Value of constant in the
' ADODB.CursorTypeEnum.
' lngLockType Value of constant in the
' ADODB.LockTypeEnum.
'
' Returns
' -------
'
'================================================= ====================
Private Function OutputConstantDescriptions(ByVal lngCursorLocation As Long, _
                                            ByVal lngCursorType As Long, _
                                            ByVal lngLockType As Long)
   Dim strRequestedCursorLocation As String
   Dim strRequestedCursorType As String
   Dim strRequestedLockType As String
   Dim strOutputString As String

   On Error GoTo Err_Handler

   Select Case lngCursorLocation
            Case adUseServer
               strRequestedCursorLocation = "Server-side"
            Case adUseClient
               strRequestedCursorLocation = "Client-side"
   End Select

   Select Case lngCursorType
            Case adOpenForwardOnly
               strRequestedCursorType = "Forward-Only"
            Case adOpenKeyset
               strRequestedCursorType = "Keyset"
            Case adOpenDynamic
               strRequestedCursorType = "Dynamic"
            Case adOpenStatic
               strRequestedCursorType = "Static"
   End Select

   Select Case lngLockType
            Case adLockReadOnly
               strRequestedLockType = "Read-Only"
            Case adLockPessimistic
               strRequestedLockType = "Pessimistic"
            Case adLockOptimistic
               strRequestedLockType = "Optimistic"
            Case adLockBatchOptimistic
               strRequestedLockType = "BatchOptimistic"
   End Select

   strOutputString = vbTab & strRequestedCursorLocation & ", " & _
                             strRequestedCursorType & " cursor with " & _
                             strRequestedLockType & " locking."

   Call WriteOutput(strOutputString)


Exit_Here:
   On Error Resume Next
   Exit Function

Err_Handler:
   Err.Raise Err.Number, "clsADOCursorAnalyzer::OutputConstantDescriptions" , Err.Description
   Resume Exit_Here

End Function

HTH,

Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
System Data Types liamfitz Beginning VB 6 0 October 17th, 2006 05:31 PM
Data Types edward2006 Infopath 0 November 7th, 2005 06:06 PM
Data types in SQL SQ SQL Language 4 October 3rd, 2004 02:07 AM
Data Types bph Access VBA 3 January 25th, 2004 05:50 PM





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