Link to home
Start Free TrialLog in
Avatar of rock2003
rock2003

asked on

Get current datetime on datebase computer.

Hi experts
I use VB to connect to MSAccess DB on another computer named \\DB.
Now I want to save current datetime of \\DB in MSAcess DB.
Who can help me?
Avatar of HaydnH
HaydnH

I don't know of anyway to specifically get the time of the other computer. However, a quick "workaround" would be to run a query that returns Now():

    SELECT Now() As MyDate FROM SomeSmallTable;

I'm guessing that the Now() function would run on the remote system returning the \\DB's time.

NOTE: I said "SomeSmallTable" for obvious reasons - the smaller the table you're querying the better performance you will get.

Haydn.

do you have access to the other computer, I mean are there directory shares is there Access or Excel installed and can you put a small piece of code there (i.e. Excel-/Accessmakro)?
If you can access the computer over a network drive you could create file on that netowrk drive using CreateTextFile and then use FileDateTime to determine that systems date/time.

Haydn.

you can also query the date/time of another computer (w/o changing something on that) by executing

 Shell "cmd /C net time \\DB > %temp%\AnotherComputersDate.txt", vbHide

then read AnotherComputersDate.txt in your temp directory
Avatar of jadedata
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ - no points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jadedata
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of SpazMODic
SpazMODic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial