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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking Date on a network

Status
Not open for further replies.

sixsmithc

Technical User
Feb 2, 2001
21
GB
Hi there,

I've got a little problem. I need to check everytime a user enters a date that it is within a certain time (ie 2 weeks maximum) but the trouble is you can easily get arround this by changing the date and time on the local computer to fool the code.

One option is to have a table in Access that stores the current date and get's checked everytime someone enters an order, but because I am not always in it would mess up the system if the date in this table had not been updated.

I have tried using Shell("Net Time \\fileserver /SET") which does set the correct TIME but doesn't alter the date, is there any way I can use something similar to check the date.
 
If you are merely trying to set a table field with the current date in order to work from, then the net time command will set your pc to the servers time. Then you can use the Date() function in Access to get you "new" system time and put it where you need it. Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
I'm afraid i have been clear.

Basicly at the moment my form looks at the date on the users computer when booking an appointment.

The rule is that the appointment must be within 30 days or it is not classed as an appointment.

This works fine except the users can change the date on there computer to fool the program into thinking it is within 30 days.

What i want to do is add a step where the code checks the date on another machine (the server) to make sure this hasn't happened.
 
Okay,

First, Education is important.....The users should not even be allowed to do this......but since they can....

Here's what I would do.....

Create a public variable....put is in the main form, or even in a module all by itself....It should read....

Public ServerTime As Date

Next, when the database is opened, have it run the Net Time shell. This will force the date of the PC to be set to the server. The next line in the code should be:

ServerTime = Date()

You have now set the public variable to the same date as the server.....

Anytime the user enters the date and you need to make sure they have not changed the PC system time, merely use:

If Date() <> ServerTime Then
MsgBox (&quot;You have altered your computer's Date. This is not allowed!&quot;)
Exit Sub
End If

This will check the PC date against the ServerTime we grabbed earlier. If the user has chaneged their PC's system time, the dates will not match and you have the trap complete.

Please feel free to ask more questions....

Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
The entire point of my question was that the Net Time doesn't syncronise the Date, it only does the time
 
Got you now.....I have never used the Net Time shell thingy so I was not aware of this....

Hmmmmm...I do remember out tech department mentioning something about a program they used that synced the &quot;Time&quot; server to a Internet site.....I am almost sure that that pulls down date and time.....Maybe you could invoke something like this and then use the above stuff about comparing to a public variable.....

Not sure....I think the name of the program they were using was AtomTime...I found a free download for it at
Help it helps...... Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top