473,394 Members | 1,932 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,394 software developers and data experts.

Select from drop down chooses wrong record

1
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!frmModLicense!cboUserSelect.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 1852
Stwange
126 Expert 100+
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!frmModLicense!cboUserSelect.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.listIndex)
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
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...
3
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...
2
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...
1
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...
4
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...
0
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...
2
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...
3
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...
0
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,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...

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.