473,320 Members | 1,978 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,320 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 1684
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.