Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Question Unanswered: Ask network for correct time: repost

    Is there a way, from Access, to ask the network for the time, instead of relying on the user's PC?
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  2. #2
    Join Date
    Aug 2002
    Posts
    2

  3. #3
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Red face

    Thanks for the lead. Unfortunately as the link described it was for NT only...
    " this code will NOT work in Windows 95 or 98."


    I have a database with an audit trail, and I as faking it out by changing my PC time. Thus I was hoping to prohibit users from changing their clock time and making it appear that their entry was earlier or later than reality.

    So, the question still remains, is there a way to ask the network for the time from a PC with windows 95, 98, etc?


    Anyone?
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  4. #4
    Join Date
    Nov 2001
    Posts
    336
    Have you tried to use command NET?

    Create batch file:

    net time \\myserver /set /yes
    exit


    When you run this batch file, it sync you local PC time with time on server \\myserver.

    Igor

  5. #5
    Join Date
    Aug 2002
    Posts
    31
    Try NetGetDCName and NetRemoteTOD

    some documentary code to accomdate different OS's

    Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
    End Type

    Private Function getVersion() As String
    Dim osinfo As OSVERSIONINFO
    Dim iRes As Integer

    osinfo.dwOSVersionInfoSize = 148
    osinfo.szCSDVersion = Space$(128)
    iRes = GetVersionExA(osinfo)

    With osinfo
    Select Case .dwPlatformId
    Case 1
    If .dwMinorVersion = 0 Then
    getVersion = "Windows 95"
    ElseIf .dwMinorVersion = 10 Then
    getVersion = "Windows 98"
    End If
    Case 2
    If .dwMajorVersion = 3 Then
    getVersion = "Windows NT 3.51"
    ElseIf .dwMajorVersion = 4 Then
    getVersion = "Windows NT 4.0"
    ElseIf .dwMajorVersion = 5 Then
    getVersion = "Windows 2000"
    End If
    Case Else
    getVersion = "Failed"
    End Select
    End With
    End Function

  6. #6
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Some programmers also use very simple trick to obtain time from a server:

    1. Create a file on server.
    2. Read date and time when the file was created.
    3. Delete file.

    HTH, Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •