Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Date from a process to a access table

Status
Not open for further replies.

miller1975

Programmer
Apr 19, 2005
58
US
Hello All,
I am running a VB batch code to get some data in Access. What I want to do is capture the date when the batch ran and store that value in a table.
For example the table where this date should stored will be called "UpdateDate" and it will have just one field called "ProcessDate".

Can this be done. Please advice.

Thanks in advance.
 
Presumably you're inserting a new record in the table when the batch runs so try something like
Code:
INSERT INTO tblRunDates (BatchNumber, UpdateDate)
VALUES ( 12345, Now() )
 
Hello Golom
Code:
INSERT INTO tblRunDates (BatchNumber, UpdateDate)
VALUES ( 12345, Now() )

Here what does 12345 do?
Why do we have to use field BatchNumber?
And will use/run this query from Access

 
I was assuming that you were inserting a new record into your table every time you ran a batch. The "12345" is where you should insert the batch number. If you don't include it somehow then you will just have a table filled with date stamps with no way to relate them to the batches.

If the record with a batch number already exists and you just want to enter the time stamp then
Code:
UPDATE tblRunDates SET UpdateDate = Now()
WHERE  BatchNumber = 12345
And again, "12345" is the batch number that you want to set the UpdateDate for.
 
One word of concern: The Now() function returns date/time from the PC that is running that VB code. You need to make sure that nobody can reset that PC's clock to some wrong value. It is safer to use the server's date/time stamps by applying Access date/time functions on the server side.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top