PC Review


Reply
Thread Tools Rate Thread

Adding Columns with ADOX

 
 
howard
Guest
Posts: n/a
 
      26th Sep 2003
Please, Help!

Everytime I run the code below, to add columns to an
existing table, Access crashes - on the line that reads:
"Set tblADD = catADD.Tables(strTBL_to_UPDATE)".

Am I doing something wrong? Is there an alternative to
using ADOX to add columns to a table. Please, help

Sub myAddColumns(strTBL_to_UPDATE As String)

Dim catADD As New ADOX.Catalog
Dim tblADD As ADOX.Table
Dim colADD As ADOX.Column
Dim rstADD As New ADODB.Recordset

Set rstADD = myFetchRecord
("Z_AddColumns", "ReportType", Left(strTBL_to_UPDATE, 4))

catADD.ActiveConnection = CurrentProject.Connection
Set tblADD = catADD.Tables(strTBL_to_UPDATE)

Do Until rstADD.EOF
Set colADD = New ADOX.Column
Set colADD.ParentCatalog = catADD
With colADD
.Name = rstADD.Fields(2)
.Type = rstADD.Fields(3)
.DefinedSize = rstADD.Fields(4)
.Properties("Nullable") = True
End With
tblADD.Columns.Append colADD
rstADD.MoveNext
Loop
rstADD.Filter = adFilterNone

Set colADD = Nothing
Set tblADD = Nothing
Set catADD = Nothing
Set rstADD = Nothing

End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Columns, Then deleting old columns May Microsoft Excel Misc 4 30th Oct 2008 04:44 PM
adding columns Masterzan Microsoft Excel Worksheet Functions 2 29th Oct 2008 09:15 AM
ADOX performance problem: first attempt to read value from open ADOX catalog lasts long time lampi Microsoft Access 0 28th Apr 2005 01:21 PM
adding columns troc Microsoft Excel Misc 3 21st May 2004 01:51 PM
Adding Two columns Praveen Kumar H S Microsoft Excel Worksheet Functions 2 1st Aug 2003 07:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:31 AM.