Results 1 to 2 of 2

Thread: Type is Invalid?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Question Type is Invalid?

    This was working fine before. Now it gives an error: "Type is Invalid!" I've marked the line of code it occurs.
    VB Code:
    1. Sub ADOCreateTable()
    2.  
    3.    Dim cat As New ADOX.Catalog
    4.    Dim tbl As New ADOX.table
    5.  
    6.    ' Open the catalog
    7.    cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    8.       "Data Source= c:\windows\system\kamo.mdb;"
    9.  
    10.    ' Create a new Table object.
    11.    With tbl
    12.       .Name = categories.txtcategory.Text
    13.       ' Create fields and append them to the new Table
    14.       ' object. This must be done before appending the
    15.       ' Table object to the Tables collection of the
    16.       ' Catalog.
    17.       .Columns.Append "FilePath", adVarWChar
    18.       .Columns.Append "FileName", adVarWChar
    19.       .Columns.Append "Filesize", adVarWChar
    20.       .Columns.Append "Artist", adVarChar
    21.       .Columns.Append "Title", adVarChar
    22.    End With
    23.  
    24.    ' Add the new table to the database.
    25.    cat.Tables.Append tbl  'ERROR OCCURS HERE
    26.  
    27.    Set cat = Nothing
    28.    
    29.    
    30.  
    31. End Sub

  2. #2
    vbCowboy
    Guest
    Kind of a wierd problem, but I pasted this code in and got the same failure, I changed the two adVarChar to adVarWChar and it works fine. Give it a shot, they both should create a text field 255 characters in length.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width