Search in subform (1 Viewer)

mikekal

Member
Local time
Today, 09:31
Joined
Jun 24, 2017
Messages
114
How can search records in subform.Main form is Form1
 

Attachments

  • Desktop Inventory.zip
    3.4 MB · Views: 108

June7

AWF VIP
Local time
Today, 08:31
Joined
Mar 9, 2014
Messages
5,490
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
 

mikekal

Member
Local time
Today, 09:31
Joined
Jun 24, 2017
Messages
114
can i use the same code for subform.Do nothing
 

June7

AWF VIP
Local time
Today, 08:31
Joined
Mar 9, 2014
Messages
5,490
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
 

mikekal

Member
Local time
Today, 09:31
Joined
Jun 24, 2017
Messages
114
How should I modify the code to refer to the subform.
 

mikekal

Member
Local time
Today, 09:31
Joined
Jun 24, 2017
Messages
114
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

Top Bottom