Use function or TempVar in Query (1 Viewer)

BiigJiim

Registered User.
Local time
Today, 14:45
Joined
Jun 7, 2012
Messages
114
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, 10:45
Joined
Apr 9, 2015
Messages
4,339
i use functions to pull a single field using DLookup.
fast and no need for a recordset.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 01:45
Joined
Jan 20, 2009
Messages
12,849
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, 14:45
Joined
Jun 7, 2012
Messages
114
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