How Often Is Now() Calculated During a Query?

whdyck

Registered User.
Local time
Today, 09:36
Joined
Aug 8, 2011
Messages
169
I'm using MS Access 2003.

I'm wondering whether Now() gets calculated once during a query or once for each record that it applies to.

For example, consider the following query:

Code:
INSERT INTO tblLiaEdiHeader
(
        CommunicationHeader, 
        ImportDateTime 
)
SELECT  DISTINCT 
        a.CommunicationHeader, 
        Now()
FROM tblLiaImport a;

In practice, every record in tbl_liaImport will have the same CommunicationHeader when this Append query is run.

Question:
If every record in tblLiaImport has the same CommunicationHeader value, is it ever possible for the above query to insert two or more records? (I want to insert that single CommunicationHeader, along with the time that it was inserted.) So does the query evaluate Now() once at the beginning of the query, then use that same value for all rows, or does Now() get evaluated for each row under consideration. If for every row, then I can see the possibility that the query might find more than one distinct record, even though there's only one distinct CommunicationHeader.

Thanks for any help you can give.

Wayne
 
Just had a play in my Sandbox and I believe that, unless you are looping through your records, Now() is calculated only the once when the query is opened.
 
Thanks, John.

That's kinda what I suspected, but I couldn't find anything in the Access Help.

Wayne
 
Even if you do loop, you would need a really slow processor from the 80's to show a difference in the time values :)
 

Users who are viewing this thread

Back
Top Bottom