Adelina_RO
Member
- Local time
- Today, 08:10
- Joined
- Apr 9, 2021
- Messages
- 42
Hi again
Here goes:
I have a continuous form to which i set the Form.Recordset property at runtime based on a ADO recordset which runs a saved procedure on a MariaDB server like so:
The problem is that when i filter either the form or the underlying recordset on a DATE field, using ([Field]>=#01/01/2021# ) AND ([Field]<=#01/01/2022# ) the resulting BaseRs.RecordCount = 50,
Frm.Form.Recordset.RecordCount = 50,
the displayed number of records is 300 !?!?
What the hell is going on?!
BONUS: If i click on any extra rows on the form and get the AbsolutePosition of the recordset it says -3 (EOF) ?!?!
Here goes:
I have a continuous form to which i set the Form.Recordset property at runtime based on a ADO recordset which runs a saved procedure on a MariaDB server like so:
Code:
On Error GoTo Eroare
SQL_SVN_OC 'function that checks if the public ADODB.Connection is running and restores it if it's not
Set BaseRs = New ADODB.Recordset
BaseRs.CursorLocation = adUseClient
BaseRs.Open "CALL `Base_Baza`('%', 'DataPrimire DESC, IdBaza DESC')", SQL_SVN, adOpenKeyset, adLockOptimistic
Set Me.Form.Recordset = BaseRs
The problem is that when i filter either the form or the underlying recordset on a DATE field, using ([Field]>=#01/01/2021# ) AND ([Field]<=#01/01/2022# ) the resulting BaseRs.RecordCount = 50,
Frm.Form.Recordset.RecordCount = 50,
the displayed number of records is 300 !?!?
Code:
Function ADO_Filter(Optional Flt As String = "") As Long
Dim Frm As Access.Form
If IsLoaded("Base") Then
Select Case Forms!base!SelTab
Case "nvB1"
Set Frm = Forms!base!nvSF!locBaza.Form
Case "nvB2"
Set Frm = Forms!base!nvSF!locDosar.Form
End Select
Else
Set Frm = Forms!baza1.Form
End If
Application.Echo False
Flt = "(DataPrimire>=#01/06/2021#) AND (DataPrimire<=#30/06/2021#)"
If Flt = "" Then
BaseRs.Filter = adFilterNone
Else
BaseRs.Filter = adFilterNone
BaseRs.Filter = Flt
End If
Application.Echo True
Set Frm.Recordset = BaseRs
ADO_Filter = CLng(BaseRs.RecordCount)
CountValues
Set Frm = Nothing
End Function
What the hell is going on?!
BONUS: If i click on any extra rows on the form and get the AbsolutePosition of the recordset it says -3 (EOF) ?!?!