Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 17th, 2006, 02:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
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
Reply With Quote
  #2 (permalink)  
Old January 17th, 2006, 04:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.