Bug with VB/Access? 
Author Message
 Bug with VB/Access?

I found what seems to be a bug in VB using Access. I am selecting the
sum of several variables using a snapshot. When the where clause
filters out all the records (0 rows should be selected), 1 row is
retrieved with the values null. The query looks like:

Dim MyDB As Database, MySet As Snapshot, MySQL As String
Set MyDB = OpenDatabase("DB.MDB")
MySQL = "SELECT Sum(col1), sum(col2) FROM table
 WHERE id = 'abc'"
Set MySet = MyDB.CreateSnapshot(MySQL)

if MySet.RecordCount > 0 then        'it's 1

When I run the same query in Access 2, essentially the same thing
happens - I get an empty record back. If I modify the query to select
count(*) from table ..., the result is 0.

It would be nice if the record count was 0  - currently I have no way
of telling if I have a valid result set, and kludge it by checking for
null values. (Selecting the count would work, but thats an extra
select.)

Can anyone enlighten me? Thanks in advance.

Eric
-------------------------------------------------------



Sat, 03 Jan 1998 03:00:00 GMT  
 Bug with VB/Access?

Quote:
>I found what seems to be a bug in VB using Access. I am selecting the
>sum of several variables using a snapshot. When the where clause
>filters out all the records (0 rows should be selected), 1 row is
>retrieved with the values null.

What you describe is the design behaviour of Access; when no rows are
selected in an aggreate query, the null value is returned.  Therefore, testing
the query result for null will tell you that no rows were examined in
computing the aggregate value.


Sun, 04 Jan 1998 03:00:00 GMT  
 Bug with VB/Access?

Have you tryed testing for MySet.EOF=false to make sure you got results.

ron.



Mon, 05 Jan 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Project98 OLE & VB: bugs, bugs, bugs

2. Bug: Access Violation 5 -- from normal VB code

3. VB.Net BUG: compiler stalls with no or slow network access

4. VB ActiveX DLL + Access 97 = MAJOR BUG

5. Tough VB data access bug?

6. Tough VB data access bug?

7. My Bug or VB.Net Bug ???

8. BUG BUG in VB

9. BUG BUG in VB

10. Access 2000 - Error accessing file - vbe6.dll bug.

11. IDE BUGs, BUGs, BUGs....

12. access 2.0 to access 97 date conversion bug

 

 
Powered by phpBB® Forum Software