MS Access Question

  • Thread starter Thread starter Roshawn
  • Start date Start date
R

Roshawn

Hi,

Does MS Access have a valid timestamp data type, or must I use the datatime
data type instead? Also how do I autogenerate these values?

Thanks,
Roshawn
 
Hi Mary

Sorry for the delay. I'm trying to implement update/insert logic while
using optimistic concurrency. IOW, I want to update/insert data into my
database and prevent recent changes from being overwritten.

HTH
Roshawn
 
¤ Hi,
¤
¤ Does MS Access have a valid timestamp data type, or must I use the datatime
¤ data type instead? Also how do I autogenerate these values?

There is nothing built in that will automatically generate the date/time. You would need to use a
function:

[DateStampField] = Now()


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Hi Paul

Would this function be created in the database as a macro/module, or would I
need to create it in .net?

Roshawn
 
¤ Hi Paul
¤
¤ Would this function be created in the database as a macro/module, or would I
¤ need to create it in .net?

You can do this at the database level for Inserts by setting the Default Value of the column to the
Now() function and omitting the column from your Insert query.

There is no such automated facility in Access for Updates so the date/time value would have to be
generated via code before executing the Update. The column would need to be included in your SQL
Update statement.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
The most efficient way of achieving that particular goal is to
consider the issue when designing and normalizing your table schema.
If you're worried about concurrency and conflicts, partition your
tables so that users are not working with the same rows at the same
time. If you have a situation where users "own" certain rows, you can
create a default value to place the login ID in a row and then have
users only be able to edit the rows that they own. Another possible
solution is to create an integer column named ConcurrencyID or some
such, and increment it by 1 on every successful save. Your code can
check that the value currently in the ConcurrencyID is the same as the
value retrieved when the row was loaded, and if not, don't save the
record.

-- Mary
MCW Technologies
http://www.mcwtech.com
 
Back
Top