arnas
Jul 29th, 2000, 03:18 PM
hi! Could somebody tell me what's wrong?
please, take a look at the code below
''''''''''''''''''''''''''''''''''''''''''''''
Private WithEvents cnnMain As ADODB.Connection
Private WithEvents rstMain As ADODB.Recordset
Private Sub rstMain_MoveComplete(... ByVal pRecordset As ADODB.Recordset)
If Not pRecordset.EOF And Not pRecordset.BOF Then
mainRecordsetCtrl pRecordset
End If
End Sub
Private Sub rstMain_WillMove(... pRecordset As ADODB.Recordset)
testMain = True
If Not pRecordset.EOF And Not pRecordset.BOF And pRecordset.RecordCount <> 0 Then
mainTestValid
If tikrinuMain Then
mainTestChanged pRecordset
Else: adStatus = adStatusCancel
End If
End If
End Sub
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim strSql As String
Set cnnMain = New ADODB.Connection
Set rstMain = New ADODB.Recordset
With cnnMain
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Persist Security Info=False;Data Source=" & glbDbFile & ";Mode=Read|Write"
.Open
End With
strSql = "select * from darbdaviai order by bylosnr"
With rstMain
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.ActiveConnection = cnnMain
.Open strSql
End With
end sub
Private Sub cmdMainRefresh_Click()
Dim strSql As String
rstMain.Close
strSql = "select * from darbdaviai order by bylosnr"
With rstMain
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.ActiveConnection = cnnMain
.Open strSql
End With
End Sub
''''''''''''''
the problem is that subroutines rstMain_MoveComplete and rstMain_WillMove works not properly after I launch cmdMainRefresh subroutine. for example, when rstMain_MoveComplete completes, a cursor jumps to different place of program than expected. usualy it is another subroutine. any ideas???
thank You in advance.
please, take a look at the code below
''''''''''''''''''''''''''''''''''''''''''''''
Private WithEvents cnnMain As ADODB.Connection
Private WithEvents rstMain As ADODB.Recordset
Private Sub rstMain_MoveComplete(... ByVal pRecordset As ADODB.Recordset)
If Not pRecordset.EOF And Not pRecordset.BOF Then
mainRecordsetCtrl pRecordset
End If
End Sub
Private Sub rstMain_WillMove(... pRecordset As ADODB.Recordset)
testMain = True
If Not pRecordset.EOF And Not pRecordset.BOF And pRecordset.RecordCount <> 0 Then
mainTestValid
If tikrinuMain Then
mainTestChanged pRecordset
Else: adStatus = adStatusCancel
End If
End If
End Sub
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim strSql As String
Set cnnMain = New ADODB.Connection
Set rstMain = New ADODB.Recordset
With cnnMain
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Persist Security Info=False;Data Source=" & glbDbFile & ";Mode=Read|Write"
.Open
End With
strSql = "select * from darbdaviai order by bylosnr"
With rstMain
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.ActiveConnection = cnnMain
.Open strSql
End With
end sub
Private Sub cmdMainRefresh_Click()
Dim strSql As String
rstMain.Close
strSql = "select * from darbdaviai order by bylosnr"
With rstMain
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.ActiveConnection = cnnMain
.Open strSql
End With
End Sub
''''''''''''''
the problem is that subroutines rstMain_MoveComplete and rstMain_WillMove works not properly after I launch cmdMainRefresh subroutine. for example, when rstMain_MoveComplete completes, a cursor jumps to different place of program than expected. usualy it is another subroutine. any ideas???
thank You in advance.