Charlotte Foust
cfoust at infostatsystems.com
Tue Oct 19 09:33:13 CDT 2004
I agree, Gustav. Sometimes a domain aggregate function is the *fastest* way to get a single piece of information, since all you're doing is effectively running a query on the fly to return a single value. Where it is slow is in a query where it executes once for every record. And in code, returning a single recordset and working with that is faster when it replaces multiple Dlookups. Charlotte Foust -----Original Message----- From: Gustav Brock [mailto:gustav at cactus.dk] Sent: Tuesday, October 19, 2004 2:05 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Open a form and find a record Hi Donald and Susan It's an old and persistent rumour that DLookup is always slow. Quite often it is not. So, Susan, give it a try - it's extremely simple and in a minute your problem will be solved and you can move on to the more funny tasks. By the way, the code could be simplified even further: strCriteria ="[QAFName]='" & Me![UsersName] & "'" If IsNull(Dlookup("[ProjectID]", "tblProjects", strCriteria)) Then MsgBox "You are not the QA on any projects." Else ' Open form ... End If /gustav > Well, I don't have to worry much about portability issues, but I'd be > interested in the opinions of folks better versed than I in the area > of optimization. I was under the impression that a simple one-time > call to a domain function in a case like this is no big deal in terms > of speed. (I suppose it depends on the size of the table.) I do avoid > using them in iterative processes, however. -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com