Monday, December 3, 2007

Create a New Recordset in VBA

Here is the sample code on how to create a new recordset.

Sub Create_recordset()
Dim rst As New ADODB.Recordset

‘Add columns
rst.Fields.Append “Field1”, adVarchar, 50
rst.Fields.Append “Field2”, adVarchar, 50


‘Create recordset
rst.Open()

‘Add rows into recordset
rst.AddNew Array("field1", "field2"), Array("string1", “val1”)
rst.AddNew Array("field1", "field2"), Array("string2", “val2”)

End Sub


Happy programming!

2 comments:

Anonymous said...

Thank you very much.

Anonymous said...

Very useful

thanks a lot

 

Get paid for your opinions! Click on the banner above to join Planet Pulse. Its totally free to sign up, and you can earn UNLIMITED. Find out more by visiting PLANET PULSE.
Sign up for PayPal and start accepting credit card payments instantly. http://www.emailcashpro.com
July Code Blog Copyright © 2010 Blogger Template Designed by Bie Blogger Template