|
-
Feb 22nd, 2005, 07:00 PM
#1
Re: Getting RecordCount [Resolved] (almost)
I'm not understanding what you mean by ran it about 8 times and what you mean by deleting everything.
Are you creating a TEMP TABLE with the rows you want to process? Could you show some real code so I can grasp this a bit better?
I'm not a VBA person - so maybe I'm confusing something in regard to that.
-
Feb 22nd, 2005, 11:17 PM
#2
Re: Getting RecordCount [Resolved] (almost)
I just used count() to get a record count, and put it into a table.
Here:
VB Code:
rs.Open "INSERT INTO TempTable (RecCount) " & _
"SELECT Count(*)" & _
"From FarmingTemp", cn, adOpenKeyset, adLockOptimistic, adCmdText
After I ran it, I had 8 records in the table, each with a different number of records in it. Then, I was getting the number from the table:
VB Code:
rs.Open "select RecCount from TempTable", cn, adOpenKeyset, adLockOptimistic, adCmdText
I wanted to know what this was returning? Was it the last record, or the first?
I just wanted to know a general rule of thumb as to how it all worked.
Now, all is good, as I delete all records before I write any, so the problem won't arise again. I just wonder what would come up if I didn't delete all of the records each time.
Was it the first record, or the last record?
-
Feb 23rd, 2005, 12:23 AM
#3
Re: Getting RecordCount [Resolved] (almost)
The "SELECT Count(*)" part gets you the number of records in the FarmingTemp table. So you
should have 8 in your RecCount field for all 8 records.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2005, 03:11 AM
#4
Re: Getting RecordCount [Resolved] (almost)
Hmm. That makes sense, but I thought they were different numbers, and selecting the count only added one record. I'm going to do it again to see exactly what is happening. Thanks.
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
|