|
-
Jul 2nd, 2002, 05:12 AM
#1
Thread Starter
Member
Create Blank Recordset
As you'll guess from this posting I'm very new to Recordsets.
My question is, how do you create a blank recordset with just column headers?
I've created the one recordset from the database, but I now need to trawl through it and sort it into a very specific order (which is not possible by query) and I thought I would add each row to a new recordset, so that this one ends up in the correct order.
Regards
John
Last edited by Manor39; Jul 2nd, 2002 at 05:29 AM.
Regards
John Pike
There are never any problems, just challenges.
-
Jul 2nd, 2002, 05:59 AM
#2
Fanatic Member
I guess you could always use an improbable criterion in your SQL statement:
e.g.
[ADO]
rs.Open ("select * from myTable where Customer = 'abcdefghi'"), myConnection
(assuming you have no customers called abcdefghi)
There doesn't seem to be any specific methods to do it.... (aside form constructin a fresh recordset from scratch - which to me is a waste of time and effort...)
-
Jul 2nd, 2002, 06:18 AM
#3
Thread Starter
Member
I forgot to mention in my previous posting that it will end up as an excel spreadsheet. My plan was to sort the recordset and then dump the lot in one go to the spreadsheet, but I think I will have post each row as I'm sorting.
Regards
John.
Regards
John Pike
There are never any problems, just challenges.
-
Jul 2nd, 2002, 06:30 AM
#4
Fanatic Member
Code:
SELECT * FROM YourTable WHERE 1 = 2
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Jul 2nd, 2002, 07:05 AM
#5
Fanatic Member
Originally posted by Manor39
I forgot to mention in my previous posting that it will end up as an excel spreadsheet. My plan was to sort the recordset and then dump the lot in one go to the spreadsheet, but I think I will have post each row as I'm sorting.
Regards
John.
There's nothing wrong with putting each line into the spreadsheet as long as you keep an instance of the spreadsheet open throughout - it may save you from having to construct complicated recordsets....
If you need help in this, just ask
-
Jul 2nd, 2002, 07:10 AM
#6
-
Jul 2nd, 2002, 07:11 AM
#7
Fanatic Member
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Jul 2nd, 2002, 07:22 AM
#8
Fanatic Member
-
Jul 2nd, 2002, 08:53 AM
#9
Thread Starter
Member
This works:
VB Code:
rs.Fields.Append "NewField", adVarChar, 50, adFldKeyColumn
rs.Open
Thanks for your help guys.
Regards
John Pike
There are never any problems, just challenges.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|