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

how to add a new field to a records

Status
Not open for further replies.

anhtri

Programmer
Sep 28, 2001
21
0
0
how to add a new field to a recordset?


dim rs as ADODB.recordset
....

rs.Append "Tracking number", adChar, 18

but it generated error

help me
thank you very much
 
Calling the fields.Append method for an open Recordset or a Recordset where the ActiveConnection property has been set, will cause a run-time error. You can only append fields to a Recordset that is not open and has not yet been connected to a data source. Typically, these are new Recordset objects that you create with the CreateRecordset method or by explicitly assigning a new Recordset object to an object variable.

Code:
Dim rs As New ADODB.Recordset
rs.Fields.Append "Tracking_Number", adChar, 18
rs.Open
rs.AddNew
rs("Tracking_Number") = "123456"
MsgBox rs.Fields("Tracking_Number")


Mark
 
Thanks Mark,
i got it
anhtri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top