473,408 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Combobox always retrieves the first client when multiple clients have same last name

I have a combobox for retrieving patient records. If I have several patients with the same last name, the combobox always retrieves the first patient with this last name, not necessarily the one selected. for instance, if I have

Smith Daniel
Smith John
Smith Ruth

Access always retieves Smith Daniel, even if I select Smith John or Smith Ruth. What am I doing wrong?

Note: Split from original thread and edited for clarity and patient confidentiality... Linq ;0)>
Dec 13 '07 #1
4 1686
Rabbit
12,516 Expert Mod 8TB
However you set it up, it's retrieving by last name only. You have to either tell it to retrieve by last AND first name or by some client ID.
Dec 13 '07 #2
missinglinq
3,532 Expert 2GB
When you use the Combobox Wizard to build a dropdown box to retrieve records, it uses the FindFirst method to do so, and that's exactly what it does, finds the first occurrence of, in this, a given last name! First and last name show in the cbo, but Access only uses the last name to retrieve the record!

The workaround to this is to create a calculated field in your underlying query that joins first and last name, then base you retrieving combobox on this new field.

In Design View for you query, go to a blank field and enter this:

WholeName: [Last Name] & " " & [First Name]

Check the Show box and run your query. You should now have a field named WholeName that contains just that, LastName FirstName!

Now go into your form's Design View, delete you old combobox and create a new one to retrieve your records, only this time use only the WholeName field in the combobox.

When you open your new combobox it'll look the same as before

LastName FirstName

but when you click on Smith Ruth you'll get Smith Ruth's record not Smith Daniel's!

Linq ;0)>
Dec 13 '07 #3
Thank guys it worked!
Dec 13 '07 #4
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Dec 13 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paul Fairless | last post by:
Customers table - contains Columns: CustID, Surname, Forename, TtlID Titles table - contains Columns: TtlID, Title TtlID is a Foreign Key in the Customers table. I have a Form frmCustomers...
8
by: Supa Hoopsa | last post by:
I have a databound combobox within a datagrid. I have set the DisplayMember and ValueMember. BUT, how do I capture the Value (SelectedValue) when the user changes the selection?
6
by: Rey | last post by:
Howdy, all. Appreciate your help. Have a one to many relation between a client and visit table. In the visit subform, I have a visittype and counselor field which are comboboxes. If I set...
3
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
7
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
9
by: Don | last post by:
Is there any way to detect when an item has been added to the Items collection of a combobox or listbox? I am inheriting a Combobox and want to validate items before they are added to the...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.