PC Review


Reply
Thread Tools Rate Thread

adlockpessimistic

 
 
=?Utf-8?B?Um9vcGVzaCBiYWJ1?=
Guest
Posts: n/a
 
      3rd Mar 2005
i have an access database
i want to update a value in a table in this database
so that this new updated field will be unique

but when more than one users are using the same
table duplicate values are being updated plz advice

i am using adlockpessimistic


plz see the coding

Function Get_Last_Counter(ByVal cn As ADODB.Connection, Optional Temp_Flag
As Boolean = False) As Boolean
Get_Last_Counter = False
On Error GoTo ErrHdlr

Dim m_strSql As String

Set m_rsCounter = New ADODB.Recordset

m_rsCounter.CursorLocation = adUseServer

'm_rsCounter.CursorLocation = adUseClient

'cn.Mode = adModeShareExclusive

If Temp_Flag = True Then
m_strSql = "Select Temp_Next_No as Document_Next_No, Last_Update
From Document_Prefix Where Document_Prefix='" _
& m_Document_Prefix & "' and Company_Prefix='" &
m_Company_Prefix _
& "' and Branch_Prefix='" & m_Branch_Prefix & "'"
Else
m_strSql = "Select Document_Next_No, Last_Update From
Document_Prefix Where Document_Prefix='" _
& m_Document_Prefix & "' and Company_Prefix='" &
m_Company_Prefix _
& "' and Branch_Prefix='" & m_Branch_Prefix & "'"
End If

m_rsCounter.Open m_strSql, cn, adOpenDynamic, adLockPessimistic ',
adCmdText
If Not m_rsCounter.EOF Then
If m_rsCounter.EditMode = adEditInProgress Then
GoTo ErrHdlr
Exit Function
End If

m_rsCounter!Last_Update = Now
m_Next_Document_No = m_rsCounter!Document_Next_No

Get_Last_Counter = True
End If
Exit Function

ErrHdlr:
m_ErrDesc = Err.Number & " - " & Err.Description
End Function

even if one user have already opened this database.
a new user can open it.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 AM.