[AccessD] Dlookups. your opinion please.

Stuart McLachlan stuart at lexacorp.com.pg
Mon Sep 22 23:31:11 CDT 2008


I use Dlookup() a fair bit.  It's fine for single lookups, but gets very slow if you use it in the 
wrong place where it gets called multiple times.  

If you have the same Dlookup in lots of different places and the value is not going to 
change over the session, call it once to initialise a static function and then use the 
function.


If you call the same Dlookup() several times in a function, populate a variable with it the 
first time and use the variable from then on.


On 23 Sep 2008 at 13:54, Darryl Collins wrote:

> Hi All,
> 
> I have, ummm, inherited a database (SQL Server Back, Access Front) at
> work.  Frankly this thing is a disaster waiting to happen and since
> the guy who built has left (he used to admin it, and I suspect there
> were regular band aid repairs and updates to keep it all steady) the
> actual users are having no end of bother and bugs with it.  anyway, I
> digress... 
> 
> The code is full of DLookups, something which I have not felt the need
> to use ever.  I think I read somewhere that using lots of dlookups is
> a bad idea.  Anyway. What is your opinion on using them?  If they are
> fine and no bother then I am happy to leave them in the code (at least
> for now).  But if they are known to be bothersome then I am more than
> happy to get rid of them and use something better. 
> 
> this thing just gets more and more ugly.  Nearly everything in the VBA
> code is dimmed as a string and they are wondering why the numeric
> fields are not populating correctly.  messy messy messy.  I can see
> someone in the past has figured out that was a bad idea and redimmed
> some stuff as double. But they have left the code like this "Dim
> strMyVariable as Double" which is a right PITA when debugging. And the
> whole show is being driven client side from Access, rather than server
> side from SQL Server... Sorry about the rant... 
> 
> cheers and get me another scotch!
> darryl.
> 
> 
> 
> This email and any attachments may contain privileged and confidential information
> and are intended for the named addressee only. If you have received this e-mail in
> error, please notify the sender and delete this e-mail immediately. Any
> confidentiality, privilege or copyright is not waived or lost because this e-mail
> has been sent to you in error. It is your responsibility to check this e-mail and
> any attachments for viruses.  No warranty is made that this material is free from
> computer virus or any other defect or error.  Any loss/damage incurred by using this
> material is not the sender's responsibility.  The sender's entire liability will be
> limited to resupplying the material.
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
Stuart Mclachlan





More information about the AccessD mailing list