473,785 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select from drop down chooses wrong record

1 New Member
I have a form that presents a user with a dropdown populated with a user name. The drop down control is bound to two things in a user table, the USERNAME and a related USERID. The drop down control bound to the second column which is the USERID.

When they make a selection from the dropdown, it populates a separate text box control with the USER ID value.

The problem is this...

When duplicate entries exist int he USERNAME field, no matter what the choice the USERID is populated with the value of the first USERNAME match.


For example:

USERNAME USERID
Jones, Robert 0001
Jones, Robert 0002
Jones, Robert 0003

If the user selects record three (Jones, Robert 0003) the form text box control that is to be populated with the user USERID will be populated with USERID value 0001 every time.

The control for the USERID display has the following control source:
=Forms!frmModLi cense!cboUserSe lect.column(1)




The desired result would be to have the text box populate with the 0003 value.
Anyone wish to venture a reason why this happens?


Thanks
Aug 17 '07 #1
1 1874
Stwange
126 Recognized Expert New Member
I have a form that presents a user with a dropdown populated with a user name. The drop down control is bound to two things in a user table, the USERNAME and a related USERID. The drop down control bound to the second column which is the USERID.

When they make a selection from the dropdown, it populates a separate text box control with the USER ID value.

The problem is this...

When duplicate entries exist int he USERNAME field, no matter what the choice the USERID is populated with the value of the first USERNAME match.


For example:

USERNAME USERID
Jones, Robert 0001
Jones, Robert 0002
Jones, Robert 0003

If the user selects record three (Jones, Robert 0003) the form text box control that is to be populated with the user USERID will be populated with USERID value 0001 every time.

The control for the USERID display has the following control source:
=Forms!frmModLi cense!cboUserSe lect.column(1)




The desired result would be to have the text box populate with the 0003 value.
Anyone wish to venture a reason why this happens?


Thanks
I'm guessing it's running a find first query, because the name is the bound field, not the ID. Try setting the bound column to be the ID instead, and see if that helps.

If not, here is another possibility:
Have two combo boxes, one hidden (to display the ID, visible/enabled = false)
Rowsource of the first: SELECT USERNAME FROM User ORDER BY USERNAME;
Rowsource of the second: SELECT USERID FROM User ORDER BY USERNAME;

Then on change/after update/whatever on the first one (the one displaying the username), do:

txtID.value = cmbID.itemdata( cmbUsername.lis tIndex)
and that should solve it

Hope that helps.
Aug 17 '07 #2

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

Similar topics

1
5257
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that radio option, like so: Choice: (Radio1) type: (select box1) Choice: (Radio1) type: (select box2) Choice: (Radio1) type: (select box3) Choice: (Radio1) type: (select box4) Choice: (Radio1) type: (select box5)
3
5300
by: Diane Yocom | last post by:
Has anybody ever seen or written code for ASP that would mimic Access' multi-column combo box? Specifically, I have a drop down box that lists about 100 five-digit codes. Each of these codes has a long text description that explains what the code represents. I'd like to be able to show the code plus description when the drop down list is dropped down, but just the code when the list is not displayed, so that I don't have to have a...
2
1501
by: SirPoonga | last post by:
Lets say I have a couple of tables in a database containg car make, type, and model. I want to create a drop down box that is populated by the makes. Based on that selection run a query to get the types of vehicles that make creates. Then baed off that the models that fit that make and type. Point me in the direction of how to do this. Thanks.
1
1989
by: It's Shroff | last post by:
I apologize in advance if I'm posting the wrong groups, but I have a general UI problem in my Windows apps that I'm wondering how other people may have solved. I am using VB.NET to devlope this application. I can't think of a way to succinctly describe my problem right now, so I'll just give you a simple example:
4
1529
by: Laura K | last post by:
I have a drop down menu which has a list of subcategories and the initial value is "please choose a Subcategory". When the user chooses a subcategory they are taken to a new page where the drop down list shows the selected subcategory in the menu. So far that is working. The problem is that when the list is showing the subcategory on the second page there are now two of that item in the list and the initial item that should be available...
0
1516
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my database has been made in MSDE. My question is simple, on my Projects form I have a 'search' button, which when clicked re-binds a datagrid with a RowFilter based on a number of user-input parameters. Two of these parameters are drop-down
2
3414
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as well as a value for the exit status of the SP. If the record doesn't exist, it selects an error message as the exit status. I've recreated the SP (while changing field names) and restructured the table, just to get straight to the point.
3
2808
by: happyman992 | last post by:
Hi, I have 2 questions. First, I am building a form with multiple drop down boxes. The options of the second drop down box will depend on what the user chooses on the first, options of the third drop down box depend on what they choose on the second, etc. The values of each option are inside a database which I can query for and put into a php array. I am wondering what is the easiest way to build this. Second, when this form is...
0
1464
by: CoreyReynolds | last post by:
Hello all! Thanks everyone for the great help you've given me so far on this forum - I have another intermediate question. I currently have a form where a user chooses a piece of equipment, followed by a subform where they can add records to it which are different parts that piece of equipment can have, which is working good! The user just clicks a drop down, selects the compartment they want to add and they My tables go tblEquipment...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8986
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.