Use function or TempVar in Query (1 Viewer)

BiigJiim

Registered User.
Local time
Today, 18:44
Joined
Jun 7, 2012
Messages
112
Hi,

I have a query which returns a single Case record, based on a case ID number which can be supplied from a number of different places. Is it better to create a global variable and a function which reads it, and then insert the function into my query WHERE clause, or should I be using a TempVar?

Thanks for any advice,

Jim
 

Ranman256

Well-known member
Local time
Today, 13:44
Joined
Apr 9, 2015
Messages
3,958
i use functions to pull a single field using DLookup.
fast and no need for a recordset.
 

Galaxiom

Super Moderator
Staff member
Local time
, 05:44
Joined
Jan 20, 2009
Messages
12,391
Its best if you can do the whole job inside the database engine rather than having to call a custom function.
 

BiigJiim

Registered User.
Local time
Today, 18:44
Joined
Jun 7, 2012
Messages
112
Thanks guys. I'm going with a Tempvar - can't see any obvious downside and the persistent value hold on code break is quite useful when developing!
 

Users who are viewing this thread

Top Bottom