Recordsetclone gives empty recordset

New Contributor

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
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

@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.