Forum Discussion

kvhmir's avatar
kvhmir
Copper Contributor
Feb 17, 2022

Recordsetclone gives empty recordset

I have code below which is in the Form-Load. According help, the Form-Load-event is triggered after the records have been loaded.  However, the Set rs = Me.Recordset retrieves no records at all. I also tried with Set rs = Me.Recordsetclone

 

If I go in debug mode through the code, line 16 is skipped.

However, the form does show the expected records.

So why is my RS-recordset empty?

 

 

Private Sub Form_Load()
Dim strSplit() As String
Dim rs As Recordset
Dim intInSpec As Integer

If Not IsNull(Parent.OpenArgs) Then
strSplit = Split(Parent.OpenArgs, "€€€€€")
Me.Filter = strSplit(1)
Me.FilterOn = True
End If
Me.Form.Section(2).Visible = False

intInSpec = 0
Set rs = Me.Recordset
While Not rs.BOF And Not rs.EOF
rs.MoveNext
Wend
End Sub

 

 

2 Replies

  • arnel_gp's avatar
    arnel_gp
    Steel Contributor
    maybe got to do with your OpenArgs, what is the value passed?
    you need a Fieldname to filter it.
    and I believe this is from the Load event of the subform?

    strSplit = Split(Me.Parent.OpenArgs, "€€€€€")
    Me.Filter = "theField = '" & strSplit & "'"
    Me.FilterOn = True
    • kvhmir's avatar
      kvhmir
      Copper Contributor

      arnel_gp 

      It's not related with the arguments.  The filter works as expected and the expected records are shown.

       

      It's indeed true the code is in the subform.

Resources