ACC1x: Implementing Counter Values on Attached SQL Server TablesID: Q100166
|
When you create a table in Microsoft Access and port it to SQL Server, some tasks are difficult to implement because SQL Server does not include a Counter data type. This article discusses how to maintain the counter functionality of an attached SQL Server table.
With a multiuser system, you must take special precautions. Assume
that the Counter column in SQL Server is called ID and that ID is the
unique index for this table. In most cases, users try to simulate
counters with a SQL Server OnInsert trigger that computes the maximum
value and adds 1. However, Microsoft Access uses that index (bookmark)
to point to the record and is not aware that the trigger is changing
the index value. Thus, Microsoft Access loses track of that record
until the next time the table is queried.
Since SQL Server triggers do not work and SQL Server does not have a
unique Counter data type as does Microsoft Access, you must use an
Access Basic function to control the counter value, as in the
procedure below:
Keywords : kbusage OdbcOthr
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: March 24, 1999