A
Atlas
A2003 + MS SQL Server 2000 (adp).
With some code in a form like:
******************************************
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
strConnect = "Provider=SQLOLEDB; server=" & globalServer & ";
trusted_connection=yes; database=" & globalDatabase & ";"
cn.Open strConnect
strSQL = "SELECT ............."
With rs
.ActiveConnection = cn
.Source = strSQL
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open
End With
rs!myfield = newvalue
rs.Update
If rs.Status <> adRecOK Then
Beep
a = MsgBox("Failed update: " & rs.Status, vbOKOnly, "Error")
End If
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
*************************************
It works and it updates successfully.
Then I've runned again the code above while the the same table was opened
with AC2003 user interface, directly from the tables list, setting the
current record to the same record being updated from the sample code above.
The code runned with no glitches but the record didn't update at all,
probably due to a previuos lock of the table itself; the strange thing is
that no error was given.
Am I missing something?
BTW the connection is the same of the currentproject; would I benefit using
CurrentProject.Connection instead of a new adodb connection?
Bye
With some code in a form like:
******************************************
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
strConnect = "Provider=SQLOLEDB; server=" & globalServer & ";
trusted_connection=yes; database=" & globalDatabase & ";"
cn.Open strConnect
strSQL = "SELECT ............."
With rs
.ActiveConnection = cn
.Source = strSQL
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open
End With
rs!myfield = newvalue
rs.Update
If rs.Status <> adRecOK Then
Beep
a = MsgBox("Failed update: " & rs.Status, vbOKOnly, "Error")
End If
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
*************************************
It works and it updates successfully.
Then I've runned again the code above while the the same table was opened
with AC2003 user interface, directly from the tables list, setting the
current record to the same record being updated from the sample code above.
The code runned with no glitches but the record didn't update at all,
probably due to a previuos lock of the table itself; the strange thing is
that no error was given.
Am I missing something?
BTW the connection is the same of the currentproject; would I benefit using
CurrentProject.Connection instead of a new adodb connection?
Bye