H
Hiro
Hello Forum Members:
I'd like to have some help on the following codes on the Access 2000:
On the Form Header, I have an unbound text box called FindWord, in which I
type some words to search. The code below works on the main form.
{code}
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.FindWord) Then
strWhere = strWhere & "([English] Like ""*" & Me.FindWord & "*"")
AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Nothing is specified.", vbInformation, "Nothing to show."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
{/code}
{code}
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
{/code}
However, what I want is that I would like to accomplish the same thing on a
SubForm inside the main Form. So I made some changes as follows:
* Me.Filter = strWhere was changed to:
Me.Child19.Form.Filter = "[English]='" & Me.FindWord & "'"
* Me.FilterOn = True was changed to:
Me.Child19.Form.FilterOn = True
This modified code is working, but
1) when I search a word such as "tomato", the result used to be like
"tomato" and "tomatoes", but now I get only "tomato".
2) when I hit the reset button on the result page, it used to go back to the
original screen, but now it just resets (clears) the word in a search box
(called FindWord unbound text box).
Would you be able to help me accomplish the above 1) and 2) on a SubForm?
With best regards,
Hiro
I'd like to have some help on the following codes on the Access 2000:
On the Form Header, I have an unbound text box called FindWord, in which I
type some words to search. The code below works on the main form.
{code}
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.FindWord) Then
strWhere = strWhere & "([English] Like ""*" & Me.FindWord & "*"")
AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Nothing is specified.", vbInformation, "Nothing to show."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
{/code}
{code}
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
{/code}
However, what I want is that I would like to accomplish the same thing on a
SubForm inside the main Form. So I made some changes as follows:
* Me.Filter = strWhere was changed to:
Me.Child19.Form.Filter = "[English]='" & Me.FindWord & "'"
* Me.FilterOn = True was changed to:
Me.Child19.Form.FilterOn = True
This modified code is working, but
1) when I search a word such as "tomato", the result used to be like
"tomato" and "tomatoes", but now I get only "tomato".
2) when I hit the reset button on the result page, it used to go back to the
original screen, but now it just resets (clears) the word in a search box
(called FindWord unbound text box).
Would you be able to help me accomplish the above 1) and 2) on a SubForm?
With best regards,
Hiro