Search filtering on a split form?

JAy3k1

Registered User.
Local time
Today, 14:48
Joined
Mar 12, 2011
Messages
14
Good evening all,

I'm looking for a little guidance if possible. I have a database in Access 2007 that uses a split form and am looking to create a search button that will filter the bottom of the form to display only the item searched for.

Now I am very new to Access and found a bit of code (I forget where!) that seems to almost do what I want, but I don't really understand how the code works or how to address the errors I am having.

Here is what I am trying to do:


  • Add a single button to filter a search on the Company field via a popup text box,
  • Somehow allow some sort of wildcard so that the search will pickup slight differences in spellings in the Company field,
  • The code to then filter the bottom of the screen.

What I have done is create an unbound text field and labelled it Feed. I then created a button, cancelling the wizard to add the required code as below.

Code:
Private Sub Filter_Click()

Me.Filter = "Company = " & Me.Feed
Me.FilterOn = True
Me.Requery

End Sub
This seems to work, but in an odd way. First you must enter something in the text field otherwise it drops out to error if you hit the button. It then creates a popup text field which you then have to enter the same search in again for it to filter the bottom of the screen

How does the above code create a popup text field? And how can I just have it so when I hit the button a text field pops up so I can then enter the filter requirements and be done with it?

What seems odd to me is that when using the text field i created and I click the button it first adds that text to the database, the text I entered then becomes the popup fields name! You then have to enter your search again to get it to filter the split form. (see below images)

Also, if I hit cancel in the popup field it goes out to error with Runtime error '2001' You cancelled the previous operation?

I am probably making this sound really complicated. But it does seem like it could be possible to make a one click button, enter your search and click ok for the filter to work. But I am at a loss.. :(

So thank you for any help given. :)


http://i55.tinypic.com/2ldy9sk.jpg

http://i51.tinypic.com/wkmdkk.jpg

http://i51.tinypic.com/2cysiv5.jpg
 

Users who are viewing this thread

Back
Top Bottom