a few multi-user environment ADP questions if you don't mind...
1) Ok, first question is, having read that CursorLocation is inherited, maybe I'm confused, but if I open a connection (cn) without specifying a CursorLocation, the default is adUseServer, which means specifying a CursorLocation for the subsequent recordset (rs) such as adUseClient is ignored and adUseServer is used?
which means the following code is incorrect:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
With rs
.Source = "SELECT * FROM tbl_Employees"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With
-----------
and should be:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CurrentProject.Connection
cn.CursorLocation = adUseClient 'ADDED TO SPECIFY
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
With rs
.Source = "SELECT * FROM tbl_Employees"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient 'DON'T NEED TO SPECIFY SINCE IT'S INHERITED??
.Open
End With
2) other question is, did I read that keyset cannot be used with adUseClient, forcing me to use adOpenStatic?
3) and can pessimistic locking be used with adUseServer/adOpenDynamic ?
4) if I set the OnOpen event to some ADO code to bind a form, then do subforms that are bound to sub-tables inherit the same rs properties automatically or should I set an OnOpen for each of those as well?
thanks for your assistance
1) Ok, first question is, having read that CursorLocation is inherited, maybe I'm confused, but if I open a connection (cn) without specifying a CursorLocation, the default is adUseServer, which means specifying a CursorLocation for the subsequent recordset (rs) such as adUseClient is ignored and adUseServer is used?
which means the following code is incorrect:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
With rs
.Source = "SELECT * FROM tbl_Employees"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With
-----------
and should be:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CurrentProject.Connection
cn.CursorLocation = adUseClient 'ADDED TO SPECIFY
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
With rs
.Source = "SELECT * FROM tbl_Employees"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient 'DON'T NEED TO SPECIFY SINCE IT'S INHERITED??
.Open
End With
2) other question is, did I read that keyset cannot be used with adUseClient, forcing me to use adOpenStatic?
3) and can pessimistic locking be used with adUseServer/adOpenDynamic ?
4) if I set the OnOpen event to some ADO code to bind a form, then do subforms that are bound to sub-tables inherit the same rs properties automatically or should I set an OnOpen for each of those as well?
thanks for your assistance