-1

I want to create a table with timestamp field in Microsoft Access 2013, but there are not timestamp or rowverion datatype. How do I do this? Is there a way to store timestamp in access?

Ahmad Sarabian
  • 144
  • 3
  • 13
  • Exactly, what are you trying to accomplish? You mention rowversion. In SQL Server, rowversion and timestamp are synonyms. They are exactly the same thing and have nothing to do with date/time. They are binary data automatically updated whenever the record is changed. So, are you looking for something like that? Or simply the Date/Time that the record was updated? – AVG Nov 02 '15 at 14:18
  • Yes, I want something exactly like the rowverion in SQL. I can use a date/time field and update manually after change data to Now(). But i want a column that automatically updated after data changing. – Ahmad Sarabian Nov 02 '15 at 16:17
  • Ahmad. Your answer contradicts itself. You say you want exactly like SQL Server rowversion. Timestamp is just another name for rowversion. Both have NOTHING to do with date/time. Yet you also say that you could do it with Now() - you can't because rowversion is binary data NOT date/time. So, I ask again. Which do you want? – AVG Nov 02 '15 at 19:42
  • I want a column That Show Is data has changed or not, And if they has changed, How many times? Sorry if my English is not so good! – Ahmad Sarabian Nov 03 '15 at 05:50
  • Possible duplicate of [What is same as TIMESTAMP datatype in Access?](http://stackoverflow.com/questions/18265685/what-is-same-as-timestamp-datatype-in-access) – Andre Nov 03 '15 at 11:16
  • The answer is No, see http://stackoverflow.com/questions/18265685/what-is-same-as-timestamp-datatype-in-access – Andre Nov 03 '15 at 11:16

2 Answers2

3

Yes, though only with a resolution of one second - set the field =Now().

For a resolution of about 1/18 second, add the fractional part of Timer:

Timestamp = Now() + (Timer() - Int(Timer())) / 86400)
Gustav
  • 53,498
  • 7
  • 29
  • 55
2

Based on your last comment, you need two fields: LastEdited (Date/Time with default = Now()) and TimesEdited (long integer with default = 0). LastEdited = Now() TimesEdited = TimesEdited + 1 Since you are using Access 2013, you can set a data macro to update both whenever the record is edited.

AVG
  • 1,317
  • 8
  • 12
  • This is OK, but not completely automatic ;-) – Ahmad Sarabian Nov 03 '15 at 18:24
  • @Ahmad - It would be completely automatic if you used an event-driven [Data Macro](https://support.office.com/en-ca/article/Create-a-data-macro-b1b94bca-4f17-47ad-a66d-f296ef834200?CorrelationId=3d9c89a1-301e-4d1b-9c80-d6ca7a6de10a&ui=en-US&rs=en-CA&ad=CA) like the answer suggests. – Gord Thompson Nov 03 '15 at 22:04