creating a search field for a form

hunterfan48

Registered User.
Local time
Today, 12:35
Joined
Aug 17, 2008
Messages
436
I would like to add a search field for a form. I want to be able to search a field, 'player name', from another table in which I would type in the players name and it would show me all the corresponding records wit that criteria in that field.

I'm entering a new transaction (in other words, I sold the baseball card) and in the top part of the form, I enter all the necessary info for the transaction part. I added a subform to show me all the cards related involved in dat transaction. However, in order to show these cards I have to go through a lot of different steps that take forever so I would like to simplify.

Ok, so obviously this transaction has no records in the subform of any cards because none have been added. I would like to add a search feature that would let me type in the player's name, (denard span) and it would open up I don't know what (maybe another subform, window, etc.) that would show me all the records containing the words 'denard span' in the players name field. From there, I would be able to add which cards I wanted to the original subform within the 'enter new transaction' form.

Appreciate the help! Thanks so much.
 
In this link scroll to the bottom and under the section "Filters and Searches" have a look to see how the Filter and FilterOn methods of the form object are used to filter a form.
 
k...I went there, but I'm not sure how to actually use that to solve my problem. If you can dumb it down for me the actual steps in making a search function on my form, that would be great for starters.

thanks!
 
Search the help files on more information on those two methods. I think there's an example there as well.

So if you wanted to search for a player name and the field is called Player_Name and the textbox is called txtPlayer_Name you do something like this:
Code:
Me.Filter = "[Player_Name] LIKE '*" & Me.txtPlayer_Name.value & "*'"
Me.FilterOn = True

To remove the filter you set FilterOn to False.
 
ok thanks...did u include the (_) because of the space in the field player name?

I'll give those 2 a try as well...
 
I'm sorry...missed that. didn't mean to make ya write it over again
 
i put a txt box titled 'text0' in the form header wit 2 buttons, but I can't get it to search thru a query and show cards with name I typed in the textbox.

What do I need to put in for code and also what do I need to put in the detail section as well?
 
You can do a couple of things to get this working but I need to know if you want to view the data in Continuous form or Datasheet view?
 
I think Datasheet, but I'm not sure what you mean by continuous??? I'd like to see both and then decide.

Thanks!
 
Simple, just do it on your form. Change the DEFAULT VIEW property to Continuous and ensure that the ALLOW DATASHEET VIEW property is set to Yes.
 
If I want my text box and 2 buttons in the header to search thru my 'cards in stock' query, how would I code that.

Also, would I put the query in the detail section of the form?
thanks,
brady
 
Pretty much brings us back to this:
You can do a couple of things to get this working but I need to know if you want to view the data in Continuous form or Datasheet view?
Which you then replied:
I think Datasheet, but I'm not sure what you mean by continuous??? I'd like to see both and then decide.
A query goes in the Record Source property of the FORM.
 
What is continuos form tho? What does that look like? I'm sorry but you really need to dumb this down...do step by step for explainin how to do this.
 
If you are interested in a totally different approach to this problem:

1. Create a new form, title it "PlayerSearchForm". In this form you want only one textbox. Use the default number that the form will assign the text box when you place it on the form (Example: Text2).

2. In the query that controls the card form, enter the following in the criteria line of the Player_Name field (assuming you are using the Query wizard)
[Forms]![PlayerSearchForm]![Text2]

3. Open the player display form. It should prompt you for [Forms]![PlayerSearchForm]![Text2] Enter a name. The form should now open with that players record displayed.

4. Go back to the Player Search Form. Place two command buttons on the form. Label the first "SEARCH" and set it to open the player display form. Set the second button to close the search form.
 
thanks for the tip but it didn't work...made all the info in the fields go blank on the form.

Was I supposed to create a regular form based off the query? Where do I put the textbox at? The Header???

Here's what I really would like to do tho...have a form that would have a search box at the top that when I type in a player's name, (first, last, first and last, etc.) it brings up in a datasheet on a form all the records for that player that I have in my 'cards in stock' query.

thanks for the help
 
What is continuos form tho? What does that look like? I'm sorry but you really need to dumb this down...do step by step for explainin how to do this.
Change the DEFAULT VIEW property of your form (under the Format tab in the Property Sheet) to CONTINUOUS FORMS then open the form and see what it looks like.

I asked you these questions because there are two different approaches. With a datasheet view you need a subform, but with a continuous form you don't need a subform. So have a look and decide which you prefer. Continuous would be easier for you.
 
I like the datasheet view...do you know how to set it up like I asked in my post above?

thanks
 

Users who are viewing this thread

Back
Top Bottom