Automatic updates in Access??

Results 1 to 2 of 2

Thread: Automatic updates in Access??

  1. #1
    Join Date
    Dec 1969
    Posts
    18

    Default Automatic updates in Access??

    Is it possible for a field in an Access database to automatically change itself? For example, I need one field to have the current time ( now() ) and another field would say, if the time now is greater than the recorded time in another field, then have the empty field say Open or Closed. Is this possible?

  2. #2
    Richard L. Guest

    Default RE: Automatic updates in Access??

    Yes, sort of. You have to create a query based on the table that has the stored time and use calculated fields to determine if it&#039s after a certain time:<BR><BR>This statement says: take the hour of the day stored in the recordedTime field and call it storedTime (24 hr clock). Then find out what hour it is on the server, and compare the two, if storedTime (the time you open) &#060;= timeNow, return OPEN otherwise CLOSED. The below expression would keep you &#039OPEN&#039 from the hour specified in recordedTime (date/time field) untill midnight!<BR><BR>To CLOSE before then, you nest anoth IIf statement where CLOSED is and reference the field with your closing time..<BR><BR>SELECT DatePart(&#039h&#039,[recordedTime]) AS storedTime, DatePart(&#039h&#039,Now()) AS timeNow, IIf([storedTime]&#060;=[timeNow],"OPEN","CLOSED") AS openOrClosed<BR>FROM tbl1;

Posting Permissions

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