Full Version: Search Issue
UtterAccess Forums > Microsoft® Access > Access Forms
MrNutzzs
Hi everyone!
I have a search combo box to search for a record based on a store name. I have some store names that are the same...and when I pick the next store in the combo box, it doesn't update the record to the correct one. So I pick 7-11 store number 2222. If I drop the box, and pick the next 7-11 (whose store number could be 3333), it doesn't update to the information for that store. All the stores that have different names, I can pick and update with no problems. What am I messing up?
Thanks for any suggestions!
Greg
DanielPineault
Can we see a sample db?
Can we see the code behind the combo box?

If the names can be the same then you need to add a 2nd criteria, or better yet use a unique criteria instead of one that presents duplicates.
MrNutzzs
Hi Daniel,
The attached is my criteria. I think I see the problem, in the "First"....I just cant find how to fix it.
DanielPineault
Without knowing more about your form design, fields, tables structure it is very hard to guide you.

Is there no unique identifier (usually the primary key) for a each store? Instead of filtering based on the name, you should be filtering based on that unique identifier (if possible).

Another solution would be to add a second criteria to your existing filter, something like:
CODE
="[Dealership]='" & [Screen].[ActiveControl] & "' AND [StoreName]='" & Forms![YourFormName]![YourStoreNameControl] & "'"
MrNutzzs
There is a PK, its the store number. That's the only thing that's individual. Store names can repeat.
DanielPineault
So, can you setup the combo box so the bound column is the store number (Pk) and then filter on that field?
MrNutzzs
I will try that and let you know the results....Thank you for pointing me in that direction!
DanielPineault
Any time, glad to help. thumbup.gif
MrNutzzs
I finally got it!!!!
Thanks for the help Daniel!!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.