View Full Version : Search on combo box, searching for text in number field???
vavroom 01-31-2002, 08:08 AM I have a form with a combo box. The combo box is populated with an SQL statement similar to:
***
SELECT tblPeople.fldPeopleID, tblPeople.fldLName, tblPeople.fldFName, tblPeople.fldMName, tblPeople.fldOrg FROM tblPeople;
***
The bound column is the first one, which is a number. Sooo, the table keeps track of a number in that field.
How can I allow my user to use the built in search function to search names?
If not possible, any good ideas on how to allow the users to search for records in that field?
Thanks in advance.
David R 01-31-2002, 08:46 AM Did you use Access' wizard for creating the combo box? This is one of Access' strengths, it sometimes automates basic tasks to the point where user error becomes much more difficult to accomplish. The third option for the wizard 'look up records based on the selection' should help you...
Post back if you have more troubles,
David R
vavroom 01-31-2002, 08:53 AM No, I fear I didn't use the wizard. For some odd reason, about half the wizards on my office's machine won't work.
In any case, the combo box works fine, it's just *searching* it. The table doesnt' have the look-up, it's just keeping a number. The only time the names are displayed is through the form. Though I'm not sure this makes sense at this point...
David R 01-31-2002, 09:18 AM No fear, your lookup is working correctly. It stores the number id corresponding to your lookup table entry for that name. This is what keeps Access from storing the same information 50-50,000 times, which could get quite extensive in the case of multi-column combo boxes.
Where are your users running into problems? They probably shouldn't be directly in the table, but even if you have a datasheet view of your form, the dropdown box should show the names. Check if the bound column is correct, is another thought.
You can also add your combo box directly to the table, but from what I recall it can cause some weird conflict/behavior between the table combo and the form combo. You may have to recreate that specific control to get it to sync properly. Other users may have more information on this 'feature'.
Good luck,
David R
[This message has been edited by David R (edited 01-31-2002).]
vavroom 01-31-2002, 09:24 AM Ok, I think I haven't expressed myself properly.
The combo box is working just fine. No problem.
The problem is when *searching* it. Say I have 100 records. They click on the "search" button on the menu bar. That is, the built in search function for A2K. They type in a name in the search box, and effectuate the search.
A2K comes up with no record found, even when there are such records in there.
Hope this makes more sense
Thanks
The Find tool cannot search your combo for names only a form with a 100 names on it. The names should be restricted/displayed when users start typing into the combo.
HTH
vavroom 01-31-2002, 10:40 AM Rich,
I'm afraid I don't understand your comment...
I used the number 100 as an example, though at this point we have over 2500 names in tblPeople. My combo box in frmContactLog calls for the names from tblPeople. That works fine. But when I try to do a search on "Johnson", for example, it tells me that there are no record found. I assume that's because we're searching for text, when the field is storing a number. I'm trying to find a way around that.
Thanks again.
I think I understand you now, try adding an unbound textbox set its control source to =[ComboName].Column(1)
vavroom 01-31-2002, 11:06 AM Ah ha! I think that might just work... It'll be column 2, but that's nothing at all :-)
I have to figure out how to wedge it in my form, as they are tight on space as is. Then I'll have to drill my user on using that text box instead of the other field, but I think it just might work wonders.
I'll try this and get back to you. Thanks Rich
David R 01-31-2002, 11:24 AM freshmaker and I had a fairly interesting discussion on how to search from a bound combo box a couple weeks ago. It seemed to work okay for him in a cramped form. Find it here (along with my more conventional unbound lookup combo): http://www.access-programmers.co.uk/ubb/Forum4/HTML/005371.html
Good luck,
David R
David R 01-31-2002, 11:25 AM Oh, and be sure you count your columns correctly, or you'll become even more frustrated. Combo box columns start at (0), not (1).
Pat Hartman confirmed elsewhere that there are idiosyncrasies with placing your lookup column directly on the table. Use the lookup wizard on your form instead.
HTH,
David R
vavroom 01-31-2002, 11:39 AM David,
Thanks for your reply.
I just noticed that I had forgotten the first column was (0). Trying a test run of it and it gave me first names instead of last names! ha!
I looked at the thread you made reference to, but I'm not too sure how to apply that to my situation. Right now though, I think I've seen "the light"...
Thanks y'all
vavroom 02-01-2002, 07:04 AM Alas!!!!
The thing works to give you and display the name, but it turns out to not be searchable...
Back to the drawing board...
David R 02-01-2002, 09:18 AM Try Rich's solution then. It may not be possible to search a combo box, I never tried.
Keep in mind that if you know the first part of it, you can start typing and it should jump to that stage of the combo...but if you know the last part, this obviously won't work.
David R
vavroom 02-01-2002, 09:25 AM It is Rich's solution that doesn't work... I mean, it shows the names all right, but you can't search it.
I have a weird feeling that I haven't expressed myself well enough and that the solutions offered aren't hitting the mark because of that.
Oh humm, I'll look at other alternatives
|
|