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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado insert....

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I have two tables... from table one I would like to copy the entire record (just the record I'm at, at that time) but I would also like to insert another value into the new table from a statistic gathered from another source.

So, I need to copy the record into a new table and in addition add a column to the new table so that I can add that new value for that record.

Could someone please explain this in as simple terminology as possible ;o)

Thanks for your help....
 
sure.. :)

here's what you'll need to do.

Create a command object:
(assuming the name of your connection is cnnConnection)
Code:
Dim cmdCommand as new ADODB.Command
'Initialize the command
cmdCommand.ActiveConnection = cnnConnection
cmdCommand.CommandType = adCmdText
cmdCommand.CommandText = "Alter Table *table name* Add *column name* as *column type*"
cmdCommand.Execute

set cmdCommand = Nothing

Then create your recordsets and copy the values from one to the other.. You will now have your extra field.

--NipsMG

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top