N
Nova
This is my code
Dim Cnx As ADODB.Connection
Dim Rst As ADODB.Recordset
Dim StrCnx As String
Dim CmdRst As String
Dim N As Integer
CmdRst = "SELECT * FROM MatStock WHERE MatID='" & MatIDSel & "';"
Set Cnx = CurrentProject.Connection
Set Rst = New ADODB.Recordset
Rst.Open CmdRst, Cnx, adLockReadOnly, -1
N = Rst.RecordCount
Msgbox N
It works, I can get N
After that I change code from adlockreadonly to adLockPessimistic,-1
but the msgbox show me -1
I don't understand (I change code because I want to update some field in
recordset
How can I correct it?
Dim Cnx As ADODB.Connection
Dim Rst As ADODB.Recordset
Dim StrCnx As String
Dim CmdRst As String
Dim N As Integer
CmdRst = "SELECT * FROM MatStock WHERE MatID='" & MatIDSel & "';"
Set Cnx = CurrentProject.Connection
Set Rst = New ADODB.Recordset
Rst.Open CmdRst, Cnx, adLockReadOnly, -1
N = Rst.RecordCount
Msgbox N
It works, I can get N
After that I change code from adlockreadonly to adLockPessimistic,-1
but the msgbox show me -1
I don't understand (I change code because I want to update some field in
recordset
How can I correct it?