Search in subform

mikekal

Member
Local time
Yesterday, 20:04
Joined
Jun 24, 2017
Messages
114
How can search records in subform.Main form is Form1
 

Attachments

1. intrinsic ribbon and right click tools
or
2. unbound controls to enter search critera review http://allenbrowne.com/ser-62.html - does not use subform so code would be adapted to reference subform container
 
can i use the same code for subform.Do nothing
 
As I said, modify code to reference subform container.

Strongly advise not to use space in naming convention.

I would name subform container control something like ctrInvTrans
 
How should I modify the code to refer to the subform.
 
How should I modify the code to refer to the subform.
Private Sub Command24_Click()

Dim strWhert As String
Dim lngLeng As Long

MsgBox Forms!test2!Child16.Form.testNUm, vbInformation, "wtf"

If Not IsNull(Me.Text20) Then
strWhert = strWhert & "( Forms!test2!Child16.Form.[testNUm] >= " & Me.Text20 & ") AND "
End If

If Not IsNull(Me.Text22) Then
strWhert = strWhert & "( Forms!test2!Child16.Form.[testNUm] < " & Me.Text22 & ") AND "
End If

lngLeng = Len(strWhert) - 5

If lngLeng <= 0 Then
MsgBox "no criteria", vbInformation, "Nothing to do"
Else
strWhert = Left$(strWhert, lngLeng)

Forms!test2!Child16.Form.Filter = strWhert
Forms!test2!Child16.Form.FilterOn = True

End If

End Sub

I found that code.Its ok
 

Users who are viewing this thread

Back
Top Bottom