Filter by selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the focus on a field. What is the code to filter by selection.
my field name is Travel Request.TA Number.
Thanks
 
Hi Chey

If TA Number is a numeric field:

Me.Filter = "[TA Number]=" & Me![TA Number]
Me.FilterOn = True

and if it's a text field

Me.Filter = "[TA Number]='" & Me![TA Number] & "'"
Me.FilterOn = True

Note that the [TA Number] after Me! is the name of the control (textbox),
which could be different from the name of the field.
 
I need a little more help I have this code already going on
Forms![Travel Request 0 Layover]![Travel Request.TA Number] = Me.[TA
Numbers].Form![TA Number]
DoCmd.Close
Now I need to do the setfocus-am I not sure how to do that.
I need to set focus to Travel Request.TA Number
then I need to filter that selection
Can you help me with this?
Thanks

Graham Mandeno said:
Hi Chey

If TA Number is a numeric field:

Me.Filter = "[TA Number]=" & Me![TA Number]
Me.FilterOn = True

and if it's a text field

Me.Filter = "[TA Number]='" & Me![TA Number] & "'"
Me.FilterOn = True

Note that the [TA Number] after Me! is the name of the control (textbox),
which could be different from the name of the field.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Chey said:
I have the focus on a field. What is the code to filter by selection.
my field name is Travel Request.TA Number.
Thanks
 
Back
Top