|
-
September 23rd, 1999, 06:42 PM
#1
VB6 + MS-Access97: Problem with RecordCount and EOF
Hi,
I'm using VB6 with MS-Access and have a little problem with RecordCount and EOF. In SQL I need something like this:
SELECT COUNT(DISTINCT survey_id) FROM question1 WHERE survey_id IN (SELECT survey_id FROM temp_surveys)
But unfortunatly, it's not supported by Access. So I tried this:
stmnt = "SELECT DISTINCT survey_id FROM question1 WHERE survey_id IN (SELECT survey_id FROM temp_surveys)"
rsBase.Open stmnt, dbBusiness, adOpenStatic, , adCmdText
base = rsBase.RecordCount
rsBase.Close
But in this snippet base is 1 even if the table temp_surveys has no records. The online-help says "Use .MoveLast", but it doesn't work either.
So, could anyone give me a hint how to solve this problem?
My second problem is related to the first one. I have an empty recordset (I'm sure it is!) and run the following code:
rsResults.Open stmnt, dbBusiness, adOpenStatic, adLockPessimistic, adCmdText
If Not rsResults.EOF then rsResults.MoveFirst
Do While Not rsResults.EOF
resultAbsolute(rsResults!option_id, subset) = rsResults!absolute
resultPercentage(rsResults!option_id, subset) = Round(rsResults!percentage, subset)
rsResults.MoveNext
Loop
rsResults.Close
Even when table on which rsResults is based is
empty, my program enters the while-loop.
I can't understand why.
Any help would be greatly appreciated.
Alex.
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
|