This one is bugging me.... I have this code:
This returns 1. When I wash that through a regular query to be:
This returns 3 records. Why would the first count 1 and the second return 3? The documentation on RecordCount seems to say that it would count the records, not count the distinct records?
In the end, I need to count the distinct records, so I guess everything is working the way I want, but I don't like it when I can't say why it is doing what I want.
Any help is appreciated.
Andrew
a.k.a. Dark Helmet
"What's the matter Colonel Sandurz? Chicken?
Code:
dim dbs as dao.recordset
dim rst as dao.recordset
so = InputBox("Enter the sale number.", "Sale Number")
sqlst = "SELECT workAssign.workCoID " _
& "FROM workType INNER JOIN (workCo INNER JOIN ((sale INNER JOIN saleItem ON sale.saleID = saleItem.saleID) INNER JOIN workAssign ON saleItem.siID = workAssign.siID) ON workCo.workCoID = workAssign.workCoID) ON workType.workTypeID = workCo.coTypeID " _
& "WHERE (((sale.saleNo)=" & so & ") AND ((workType.workTypeID)=1));"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(sqlst)
MsgBox rst.RecordCount
Code:
SELECT workAssign.workCoID
FROM workType INNER JOIN (workCo INNER JOIN (sale INNER JOIN (saleItem INNER JOIN workAssign ON saleItem.siID = workAssign.siID) ON sale.saleID = saleItem.saleID) ON workCo.workCoID = workAssign.workCoID) ON workType.workTypeID = workCo.coTypeID
WHERE (((sale.saleNo)=204177) AND ((workType.workTypeID)=1));
In the end, I need to count the distinct records, so I guess everything is working the way I want, but I don't like it when I can't say why it is doing what I want.
Any help is appreciated.
Andrew
a.k.a. Dark Helmet
"What's the matter Colonel Sandurz? Chicken?