Article ID: 109334
Article Last Modified on 1/18/2007
Label
------------------
Caption: Search ID
Text Box
-------------------------------
Name: SID
ControlSource: <leave blank>
AfterUpdate: Filter.Make null 2
NOTE: In versions 1.x, the Name property is called the ControlName
property.
Label
--------------------------
Caption: Search First Name
Text Box
-----------------------------------------------------
Name: SName
ControlSource: <leave blank>
Validation Rule: Not Like "*'*" Or Is Null
Validation Text: Can't use apostrophe in filter text.
AfterUpdate: Filter.Make null
NOTE: In the following example, an underscore (_) is used as a
line-continuation character. Remove the underscore when re-creating
this example.
In Microsoft Access 7.0:
Text Box
-------------------------------------------------------------------
Name: Where Text
ControlSource: =Mid((" And [Employee ID]="+[SID]) & _
(" And [First Name] Like '"+[SName]+"'"),2)
In Microsoft Access 1.x, 2.0 and 97:
Text Box
-------------------------------------------------------------------
Name: Where Text
ControlSource: =Mid((" And [Employee ID]="+[SID]) & _
(" And [First Name] Like '"+[SName]+"'"),6)
Command Button
---------------------------
Caption: Apply Filter
OnClick: Filter.Apply Filter
NOTE: In versions 1.x, the OnClick property is called the OnPush
property.
Macro Group: Filter
--------------------------------------------------------------
Macro Name: Make null
Condition: IsNull(Screen.ActiveControl)
Action: StopMacro
Description: This macro is for text fields.
Condition: Len(Screen.ActiveControl)=0
Action: SetValue
Item: Screen.ActiveControl
Expression: Null
Description: Make an empty text field null.
Macro Name: Make null 2
Condition: IsNull(Screen.ActiveControl)
Action: StopMacro
Description: This macro is for numeric fields.
Condition: Not IsNumeric(Screen.ActiveControl)
Action: SetValue
Item: Screen.ActiveControl
Expression: Null
Description: Turn non-numeric values into nulls.
Macro Name: Apply Filter
Condition: IsNull([Where Text])
Action: ApplyFilter
Where Condition: True
Description: No Where Text, so select all records and stop.
Condition: ...
Action: StopMacro
Condition: Len([Where Text]) > 255
Action: MsgBox
Message: You have selected too many criteria in the filter.
Title: Apply Filter
Description: If filter too long, display warning and stop.
Condition: ...
Action: StopMacro
Action: ApplyFilter
Where Condition: =[Where Text]
Description: Apply the filter.Additional query words: dynamic QBE query by example
Keywords: kbhowto kbusage KB109334