Glad to know there is another using ADO rather than DAO. Unfortunately by design intent ADO does not know the infrastructure of Jet.
However there is the Extension for Security and DDL, 'ADOX'. Underneath the Catalog object you will find all the methods and properties you need for adding another column to your table. Remember to reference this library.
I hesitate to offer more help because everytime I find myself hereabouts I only get things to work by trial and error. Still you could ignore that and ask anyway.
Sorry, I answered a slightly different question the first time round. You need ADOX to add a new column to a table but adding a new field to a recordset can be done via ADO. So you don't need to add a new reference. (For future reference the name of ADOX in the list is 'Microsoft ADO Ext. n.n. for DDL and Security'.)
So sticking with ADO: the Recordset object has a collection called Fields and the Fields collection has a method Append. Here's an extract from the Help
Appends an object to a collection. If the collection is Fields, a new Field object may be created before it is appended to the collection.
What I suggest you do is instatiate a new Field object and then Append it to the Fields collection in your Recordset. I guess the Type property of your Field should be adBoolean.
Thank you very much. I successfully add a new column to the recordset. even i still have other problem.
But adding new column to recordset is ok now.
I just share the way i did.
First i select data i want to recordset1
then i declare new recordset2, and add all the columns to recordset2
then insert all data into recordset2.
My original mistake is, i try to add column into recordset1. since it already have data after i select, so i can't add new column. I can't add before it either, because i have to select data into after i add new column.
Here is the code
strSql = "Select Fund, Deal, [Deal Name] from dbo_tbl_irrdeals where " _
.Open strSql, Con, ADODB.adOpenForwardOnly, ADODB.adLockBatchOptimistic
I have one subform, which can be either bound form or unbound form. it doesn't really matter.
I got some data from recordset like previous post. and manipulate recordset. After certain action, then decide whether save data into the database.
I think the good way to do it is by using the disconnected recordset, which use ADO
but Now, the problem is I don't know how to display the recordset into my form.
The way display in the bound form: me.recordset = rscp
It give me error: the object you entered is not a valid recordset property
Is anyone know how to display the disconnected recordset in a form???