Filtering or Getting Record

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

Guest

Hi it is My first time to write to you. I'am here to ask you solve my promble
which is as follows:

I Have a form and subform >
My subform record source is customer table>
on my main form I have a text box object
I want the records in my sub form to be filtered acording to my in put in
that text box in my main form.

so can you help me about that?
by: Rashid email: (e-mail address removed)
waiting your reply
 
yes, this is not too difficult. there are many ways you can do this,
but one way is as follows.

Private Sub TextBox1_AfterUpdate()
' Find the record that matches the control.
Dim stFilter As String

subform.FilterOn = False

stFilter = "[YourField] LIKE '" & Me.TextBox1 & "'"

subform.Filter = stFilter
subform.FilterOn = True
End Sub

put that in your code and it should work. let me know how it works out
and if you ahve any issues

~Brian
 
Thank you for you time and Help
I am still have the problem . I have done what you have told me and it
says(Member or data method not found ) and selects FilterOn

thank you and Still need your help
 
i forgot to mention to you something that you need to change. check
the name of the textbox you are entering your filter criteria in and in
the code look for anywhere it says "TextBox1" and change it to your
text box name. Also, in the code where it says "YourField" change that
to the field that you are filtering by. (ex. if you want to filter the
field 'ID' change the 'YourField' text to 'ID') let me know if you
already did this, or if this does not fix the problem
 
I have done that allready and not working . the reason is as I think it
doesn't recognize the word FilterOn so it is always highlighted by the
compiler
 
also make sure you change the name of the subform in the code

anywhere teh text 'subform' appears in the code i provided, replace
that with 'Form_YourSubformName' where YourSubformName is obviously the
name of your subform.
 
Sorry, To keep you saying Not working it is still not working But what about
if I sent to you sample database with that forms and table and you fix and
then sand me back
 
yes that will work then i can tell you for sure what is happening.
send it over and ill take a look.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top