Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding fields to an existing table using ADO

Status
Not open for further replies.

SkipVought

Programmer
Dec 4, 2001
47,487
US

I have a table with 4 columns. I want to add 3 additional columns and then update the values in those columns for each row in the table.

I cannot get past creating the 3 new fields...
Code:
        With rsDSC
            .Open "tAll_DSC_Active_Inactive", cnn, adOpenDynamic, adLockOptimistic, adCmdTable

            With .Fields
                If .Count = 4 Then
                    'add 3 columns for Category, RQ Qty and RESP
                    'Collection.Append Object
                    'fields.Append Name, Type, DefinedSize, Attrib, FieldValue
                    .Append "Cat", adChar
                    .Append "RQ_QTY", adInteger
                    .Append "RESP", adChar
                    .Update
                End If
            End With
        End With
What am I missing?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Personally I'd use an ALTER TABLE ddl statement.
and then update the values in those columns for each row in the table.
With which value(s) ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



PHV, Thanks.

That was what I needed to add columns.

The remainder is not an issus.

Skip

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
As far as I know you can't add fields to an underlying table by adding them to a recordset.

I've only ever added fields to a recordset when I was building one from scratch (rather than from querying a table), or when I wanted to add some temporary fields to use while processing the data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top