Kumar-
That's not the ideal solution if, in fact, you're filtering on a number that definitely exists. You should use = and remove the quotes, like this:
If Not IsNull(Me.cboSearchSEnum) Then
strWhere = strWhere & "( SESNum = " & Me.[cboSearchSEnum] & ") AND "
End If
'***********************************************************************
'Chop off the trailing " AND ", and use the string as the form's Filter.
'***********************************************************************
'See if the string has more than 5 characters (a trailng " AND ") to remove.
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND " at the end.
strWhere = Left$(strWhere, lngLen)
'For debugging, remove the leading quote on the next line. Prints to Immediate Window (Ctrl+G).
'Debug.Print strWhere
'Finally, apply the string as the form's Filter.
Me.Filter = "ID IN (SELECT LinkID FROM T_SES WHERE " & strWhere & ")"
Me.FilterOn = True
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of access_kri@yahoo.com
Sent: Monday, December 02, 2013 6:05 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: RE: RE: RE: RE: RE: [MS_AccessPros] Search data of subform from Main Form
John-
You are genius. I removed = and substituted with like and it works as desired. Thanks a lot.
Regards,
Kumar
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote:
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (12) |
Tidak ada komentar:
Posting Komentar