Question on how time is handled in an append query

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hi All,

I've got a query that pulls several hundred records from an external
database (Progress) that is linked to my Access (2K) database via ODBC. One
of the things I need to do is to assign each record a run time
[Format(Now(),"hh:nn AM/PM")] & run date, which are stored in separate
fields. My question is: will all the records receive the same time
component of the time stamp, even when the time during which the query runs
crosses minutes?

For example, if I start the query at 11:59 and if it finishes running at
12:00, will some of the records be stamped 11:59 and the balance 12:00?
I've run this with over 30K records and all are stamped with the time at
which the query starts running.

It looks like all the records get the same time stamp, being the time at
which the query fires off, but I just want to be sure.

Any feedback is appreciated.

Thanks & Ciao,

Tony
 
Yes, they will all get the same date time unless you do something to force
Access to get the date time for each record. That would involve using a VBA
function to return the date time and it would involve passing a field
reference to the function to make Access call the function for each row.

Function GetDateTime(vAnything) as datetime
GetDateTime = Now()
End function

In the query

Format(GetDateTime(SomeField),"hh:nn AM/PM")
 
Thanks for the response, John. The way it works is what I need, but I
wanted to see what input others had.

Thanks, again.

Tony


John Spencer said:
Yes, they will all get the same date time unless you do something to force
Access to get the date time for each record. That would involve using a
VBA function to return the date time and it would involve passing a field
reference to the function to make Access call the function for each row.

Function GetDateTime(vAnything) as datetime
GetDateTime = Now()
End function

In the query

Format(GetDateTime(SomeField),"hh:nn AM/PM")


Tony said:
Hi All,

I've got a query that pulls several hundred records from an external
database (Progress) that is linked to my Access (2K) database via ODBC.
One of the things I need to do is to assign each record a run time
[Format(Now(),"hh:nn AM/PM")] & run date, which are stored in separate
fields. My question is: will all the records receive the same time
component of the time stamp, even when the time during which the query
runs crosses minutes?

For example, if I start the query at 11:59 and if it finishes running at
12:00, will some of the records be stamped 11:59 and the balance 12:00?
I've run this with over 30K records and all are stamped with the time at
which the query starts running.

It looks like all the records get the same time stamp, being the time at
which the query fires off, but I just want to be sure.

Any feedback is appreciated.

Thanks & Ciao,

Tony
 
Back
Top