DCount or OpenRecordset what is better

Are you basing that on the test in post #16?

nope. that's why I wrote "I imagine" ;)
only on the fact it will bring a result once it find the first (random) accurance, and as I look for the Key any record must have it.
 
nope. that's why I wrote "I imagine" ;)
only on the fact it will bring a result once it find the first (random) accurance, and as I look for the Key any record must have it.
Give it a quick test and you will be suprised what the result is ;)
 
Another thing worth mentioning in this discussion of DomainAggregate vs Recordset:
The domain aggregate functions provided by the Access.Application object, so DLookup(), DCount(), etc... are never aware of transactions, as demonstrated...
Code:
   CurrentDb.Execute "UPDATE MyTable SET Field1 = 0" [COLOR="Green"]'sets all field1 to 0[/COLOR]
   Debug.Print DLookup("Field1", "MyTable")          [COLOR="Green"]'displays 0 in the immediate pane[/COLOR]

   DBEngine(0).BeginTrans
   CurrentDb.Execute "UPDATE MyTable SET Field1 = 1" [COLOR="Green"]'set all field1 to 1[/COLOR]
   Debug.Print DLookup("Field1", "MyTable")         [COLOR="Green"] 'still displays 0 in the immediate pane[/COLOR]

   DBEngine(0).CommitTrans
   Debug.Print DLookup("Field1", "MyTable")          [COLOR="Green"]'displays 1 in the immediate pane[/COLOR]
I spent a long time once finding this out.
 
I think this is because the CommitTrans is what close the transactions, and realy do it.

it's like when you run an update query, the query run for some time and at the end you get the message "Do you want to update ...." only after you click "Yes" data is realy writen and query ends.
 

Users who are viewing this thread

Back
Top Bottom