Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to convert ADO.rs.field.type to DAO.rs.field.type?

Posted on 2001-06-25
2
Medium Priority
?
401 Views
Last Modified: 2012-06-21
Hi,

I need to create mdb files on the fly with data from SQL server. I'll be getting data through ADODB.rs. When I try to create mdb file using the following syntex:

Set dbDatabase = CreateDatabase(sNewDBPathAndName, dbLangGeneral, dbEncrypt)

For Each fld In rs.Fields
    Set fldArray(i) = tdLogTable.CreateField(fld.Name, fld.Type, fld.DefinedSize)
    i = i + 1
Next

the program error out at the table.CreateField method. The "fld.Type" returns an ADODB.rs.field type which can't be recognized by the CreateField method. Can anyone show me how to solve this? Thanks in advance!
0
Comment
Question by:ahpui
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
rkot2000 earned 150 total points
ID: 6224775
i am using the following select case to convert from ado to string. You can do the same :
Function GetDataTypeEnum(lngDataTypeEnum As Long) As String
      'Given ADO data-type constant, returns readable constant name.
      Dim strReturn As String
         Select Case lngDataTypeEnum
            Case 0: strReturn = "adEmpty"
            Case 16: strReturn = "adTinyInt"
            Case 2: strReturn = "adSmallInt"
            Case 3: strReturn = "adInteger"
            Case 20: strReturn = "adBigInt"
            Case 17: strReturn = "adUnsignedTinyInt"
            Case 18: strReturn = "adUnsignedSmallInt"
            Case 19: strReturn = "adUnsignedInt"
            Case 21: strReturn = "adUnsignedBigInt"
            Case 4: strReturn = "adSingle"
            Case 5: strReturn = "adDouble"
            Case 6: strReturn = "adCurrency"
            Case 14: strReturn = "adDecimal"
            Case 131: strReturn = "adNumeric"
            Case 11: strReturn = "adBoolean"
            Case 10: strReturn = "adError"
            Case 132: strReturn = "adUserDefined"
            Case 12: strReturn = "adVariant"
            Case 9: strReturn = "adIDispatch"
            Case 13: strReturn = "adIUnknown"
            Case 72: strReturn = "adGUID"
            Case 7: strReturn = "adDate"
            Case 133: strReturn = "adDBDate"
            Case 134: strReturn = "adDBTime"
            Case 135: strReturn = "adDBTimeStamp"
            Case 8: strReturn = "adBSTR"
            Case 129: strReturn = "adChar"
            Case 200: strReturn = "adVarChar"
            Case 201: strReturn = "adLongVarChar"
            Case 130: strReturn = "adWChar"
            Case 202: strReturn = "adVarWChar"
            Case 203: strReturn = "adLongVarWChar"
            Case 128: strReturn = "adBinary"
            Case 204: strReturn = "adVarBinary"
            Case 205: strReturn = "adLongVarBinary"
         Case Else:
            strReturn = "Unknown"
          End Select
         GetDataTypeEnum = strReturn
      End Function
0
 

Author Comment

by:ahpui
ID: 6229356
Thanks! It works after a minor modification.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question