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

Populate EMP_ID control with selection from EMP_NAME control

Platform = Windows
Program = Access 2003


Hi there, I am stumpped!!

I am attempting to populate a form control as follows:

I have a form that has 2 drop-down boxes. One retrieves the EMP_ID and the 2nd one retrieves the EMP_NAME and EMP_ID.

When I make a selection from the EMP_ID control, the data in the database appears accordingly. When I make a selection from the EMP_NAME control, the data in the database appears accordingly, as well.

I am attempting to have it so when I make a selection from the EMP_NAME control, the EMP_ID control becomes populated with the EMP_ID that corresponds to the selection that I make using the EMP_NAME control.



RowSource for EMP_NAME
SELECT distinct T_EMPLOYEE_2.EMP_NAME , T_EMPLOYEE_2.EMP_ID FROM T_EMPLOYEE_2 ;



Expand|Select|Wrap|Line Numbers
  1. Private Sub Cmd_EmpName_Click()
  2.   Dim rs As Recordset
  3.  
  4.   Set rs = Me.Recordset.Clone
  5.   rs.FindFirst "[EMP_NAME] = '" & Combo_EmpName.Value & "' "
  6.   If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  7. End Sub
  8.  
=================================================

Rowsource for EMP_ID
SELECT DISTINCT T_EMPLOYEE_2.EMP_ID FROM T_EMPLOYEE_2;



Expand|Select|Wrap|Line Numbers
  1. Private Sub Cmd_EmpID_Click()
  2.  
  3.    Dim rs As Recordset
  4.  
  5.    Set rs = Me.Recordset.Clone
  6.    rs.FindFirst "[EMP_ID] = '" & Combo_EmpID.Value & "'"
  7.    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  
When I run them independently of each other, they work just fine, but I need to have the EMP_ID control be populated with the EMP_ID when a selection is made from the EMP_NAME form control and also have the EMP_NAME control populate accordingly when a selection is made from the EMP_ID form control.

I hope I have supplied enough information and have explained it clearly enough for someone to help me.

Can someone please help me with this???

Thank you VERY MUCH for your assistance.
Aug 19 '08 #1
1 1677
NeoPa
32,556 Expert Mod 16PB
This all sounds like an overcomplication. A single ComboBox with both items in it is fully referenceable from code. There is no "valid" reason I can see why you would want to set them up as you have.

Having said that, the way to do it would be to set the value of the "other" ComboBox whenever one has an item selected.

Travel this path and expect problems though.
Aug 20 '08 #2

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

Similar topics

1
by: Cindi | last post by:
Hi, Another newbie with a question that I hope someone can point me in the right direction. The goal is to populate a text box with data according to the selection in a combo box while still...
1
by: Matthew Louden | last post by:
Personally, I am totally confused with the following control terms and usage and advantages of each one in ASP.NET web application. Here's what I know so far.. 1. HTML Client Control: understood...
1
by: Reza Solouki | last post by:
Hello, I have a dropdown list control, where there are cases that I need to populate the control from a database and select one of the items in this list after. Because the content of this...
1
by: rajarameshvarma | last post by:
Hi, I have two user controls in an asp.net webpage each contains a DropDownList. Depending on the selection of the drop down in one user control i need to populate data in the other drop down...
4
by: Nate | last post by:
I am looking to populate a Schedule table with information from two other tables. I am able to populate it row by row, but I have created tables that should provide all necessary information for me...
2
by: Nate | last post by:
I am looking to populate a Schedule table with information from two other tables. I am able to populate it row by row, but I have created tables that should provide all necessary information for me...
1
by: KMEscherich | last post by:
Using Access '97 Hi there, am wondering if someone can please help me with the following: I have a master table (T_INVESTIGATION) that contains the following fields as well as other fields. ...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
5
by: =?Utf-8?B?U2F0aXNo?= | last post by:
C#, ASP.NET Q: Have a formview, with a dropdownlist which is bound to a column. This dropdownlist has a datasource of DataSet type. Now my objective is, on Selection Changed of this DropdownList,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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
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
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...

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.