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

Get date from Server? 1

Status
Not open for further replies.

evalesthy

Programmer
Oct 27, 2000
513
US
I have some forms that I would like to lock if record was not created today (or within last x number of days). Obviously, this is easy to bypass by user if I just check desktop date as they can reset their desktop date. Getting date form server would be a better option. Is their a simple way to do this in code?
 
For example. In the front end (split database) if I call Date() in the form onOpen event it returns the front end (desktop) date setting, not the server date setting.

So, if I run a little test like:

If Me.EnteredDate <> Date()

could easily be fooled by user resetting desktop using "Adjust Date/Time".
 
I've once used the (perhaps a little dirty) approach of creating a text file on the server, then reading the DateLastModified property from it, using the filesystemobject, then deleted the file (to avoid concurrent access to the same textfile, I used a randomized name - part of username and timestamp).

Roy-Vidar
 
Roy: Thanks. If I don't come up with another way I may ask for your help with the coding. Clever work around - but isn't there some easier way to call the Server settings? Beyond my scope of knowledge but seems logical to me.
 
Here's a trick that may work for you.

Create a Pass-Thru query referencing a small linked table on your server.
Here's the code I used to get the Server datetime.

Select Getdate() as ServerDate, Count(*) As MyCount From MyLinkedTable;

You could execute this, save the result and do your compares from there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top