473,397 Members | 2,028 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,397 software developers and data experts.

Select duplicate names from listbox

Hi All,
Need some help with a listbox display to textbox...After loading my listbox from the database, I need to be able to select duplicate names and display them in a textbox....it works fine on the first name but if there is a duplicate last name it still displays the first one no matter which one you click.....below is the code I am trying to use.......Please any help would be appreciated........

Set RS = db.OpenRecordset("Select * from retmem where [lname] = '" & Trim(list1.list(list1.ListIndex)) & "'")

txtfirst.Text = RS("fname")
txtlast.Text = RS("lname")
Oct 16 '07 #1
3 1740
Hi All,
Need some help with a listbox display to textbox...After loading my listbox from the database, I need to be able to select duplicate names and display them in a textbox....it works fine on the first name but if there is a duplicate last name it still displays the first one no matter which one you click.....below is the code I am trying to use.......Please any help would be appreciated........

Set RS = db.OpenRecordset("Select * from retmem where [lname] = '" & Trim(list1.list(list1.ListIndex)) & "'")

txtfirst.Text = RS("fname")
txtlast.Text = RS("lname")

Hi Jerry

Have u tried using the SEEK Method where u can specifically search the field from the database base on its index.

Good luck
Oct 17 '07 #2
debasisdas
8,127 Expert 4TB
Try to use DISTINCT or UNIQUE key word in the SQL statment to filter the duplicate values.
Oct 17 '07 #3
Hi Jerry

Have u tried using the SEEK Method where u can specifically search the field from the database base on its index.

Good luck
Thank you, but I am not sure of the code format for the seek with index, do you have an example ..thanks so much........Jerry
Oct 25 '07 #4

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

Similar topics

5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
14
by: Jos? | last post by:
This one droves me completely mad. I did not succeed to exploit the track given to me by Bob. I have : three tables : Clubs, Persons and ClubsPersons that join the two first in a many to many...
5
by: Melissa Cowan | last post by:
I am using Access 2000. I have the Developer's handbook and got the code for the mulit select listbox from there. It sends the selected value to another listbox, lstselected. What I need to do is...
1
by: pcb | last post by:
Hi All, I have a multi-select listbox, that can have duplicate items (i.e samples numbers that are analyzed in duplicate - the sample IDs are not the same, but these IDs are hidden from the...
2
by: Arnold | last post by:
Greetings Gurus, In a report showing the names of students and their progress, I am getting an error in the name field (Name: #Error). The report gets its data from an unbound form containing...
1
by: Melson | last post by:
Hi Can anyone give suggestions please. I need to create a list (probably using listbox) and fill with names in the listbox. When I enter a name (maybe Adam) in a program (notepad, MS words,...
10
by: SanMiguel12 | last post by:
Hi, I have a huge problem which drives crazy for a month... I am working on a database program and I am using .net2005 and Sql server 2003. In a form I have a listbox and two texboxes and there's...
5
by: OldBirdman | last post by:
I am attempting to assign a .RowSource to a ListBox using an SQL statement. I want to build the SQL statement "On-the-Fly", based on values in several controls on the form. I would like to restrict...
3
by: 6afraidbecause789 | last post by:
If able, can someone please help make a Where clause that strings together IDs in a multi-select listbox AND includes a date range. I wasn’t thinking when I used the code below that strings...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.