Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter on current tex box on form 1

Status
Not open for further replies.

wz

Programmer
Feb 16, 2001
88
US
I would like to show all records that = a certain text box on a form.

the help gives me:

Me.Filter = "Country = 'USA'" '(I want this to be a control (text box) on the form)
Me.FilterOn = True

I want the end user to be able to view all data for a product that is selected on a form. The table behind the form has many products listed but I want the end user to click on a command button that shows all records just for that product. Currently the form is a dataentry only screen but I want them to view all for that product & edit when nessessary.

Any help?
 
How are ya wz . . .

That woud be:
Code:
[blue]Me.Filter = "[Country] = '" & Me![purple][B][I][YourTextboxName][/I][/B][/purple] & "'"[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
DoCmd.ShowAllRecords
Me.Filter = "[CostCenter] = '" & Me![CostCenter] & "'"
Me.FilterOn = True

thanks - however I am not getting it filtered on current [CostCenter] - it is filtering on the [CostCenter] that is first in my recordset.

any ideas why?

First I showallrecords because this is a dataentry screen & then I want it to filter on current [CostCenter]. This [CostCenter] is a bound control that is disabled on this entry screen - it is being "pushed" from another form in which the user chooses [CostCenter] from a dropdown list.
 
And this ?
Code:
Dim strCenter As String
strCenter = Me!CostCenter
DoCmd.ShowAllRecords
Me.Filter = "CostCenter='" & strCenter & "'"
Me.FilterOn = True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you to both of you....I was starting to pull my hair out :).

Yes, that worked PHV. THANKS A MILLION, WZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top