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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having trouble getting my form to look up user input with a "like" con

Status
Not open for further replies.
Jul 13, 2004
5
0
0
US
I have a form that accepts user input and is supposed to look up information from my table using the "like" condition and display the results in a subform for the user to select from. For instance, if I were to type in the word church, the subform is supposed to display bethel ame church, church of god in christ, st. mary's catholic church, etc. Unfortunately, my input text form is not working correctly and it displays each record one by one whenever i hit enter in the text box. Does anybody have any input?
 
And what have you so far ?
Have you tried to browse the FAQ area in this forum ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi

You do not explain how you are actually doing it, but if I were doing I would do the following:

Base the sub form on a query, with criteria of Like "*" & Forms!MyMainForm!MyTextBox & "*"

In the after update event of the control MyTextBox on the main form put Me.MySubFormControl.Requery

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I'm sorry i'm not explaining my methods very well. I just started learning how to use access and i don't quite understand everything i'm doing yet.

OK, my subform is taking information from my main form (the text box i believe) and comparing what i type in to the records in my table. From there, my subform is supposed to display everything that contains what was typed into the text box.

As far as my text box goes, it says that it is unbounded right now. I don't know if that's a good thing or a bad thing. Should it be bounded to a table in order for the subform to be able to pull up information, or do the two depend on each other in that way?
 
Thanks a bunch. I tried it and it works. But i put in the code in the query and now i can't see how to link it to my form. Whenever i run the query, it works. Now i want to do the same thing on my form and i don't know where to place the code or link it to my query. Is there supposed to be a field in the properties window that allows me to link the two together?
 
Hi

You set the .recordsource property of the form (you are using as the subform) to the query, or copy the SQL of the Query and paste it into the .Recordsource property of the form

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
OK i got that working, now when i open the form the popup box comes up and asks me what i want to look up. how do i make it so i do the query/requery on my form page. I don't know if that makes sense or not.
 
Hi

can we just step back

You have a main form (say MyMain)

You have a textbox on that main form (say MyText)

You have a subform, based on a query, in that query you have a criteria

The criteria should be Like "*" & Forms!MyMain!MyText & "*"

If you run the main form, it should not ask for parameters, unless you have miss-spelled the name in the criteria of the query

If you run the subform alone (ie the may form is not open it will ask for paramters, since the main form is not open



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top