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

combobox on userform dependent on one another

I have two combo box on a user form "Name" and "ID". When I select name, it automatically displays ID correspond to that in excel (source). I want, if I put either of the information (ID or name) other one automatically displays.
Apr 23 '19 #1
3 1305
twinnyfo
3,653 Expert Mod 2GB
gunjanbhatia48,

Welcome to Bytes!

What have you tried so far? Without knowing anything more about your project we can't provide any solid advice.

As initial advice, I would recommend changing the names of your Combo Boxes to "cboName" and "cboID". First, because "Name" is a reserved word in the Access engine, and second, because this will disambiguate between the Combo Box itself, an underlying field named "Name" (which you should never do in the first place), the Name of the Combo Box, and the Name of hte Form. This is not an answer to your question, but just some helpful advice for the future.
Apr 23 '19 #2
NeoPa
32,556 Expert Mod 16PB
First of all twinny's advice is well worth following.

Now let's get to your question. There's very little here, as Twinny says, so any response will necessarily be very limited. You really do need to start by giving careful consideration to exactly what it is you're trying to achieve before asking the question. Imagine trying to give any sort of reliable answer when you haven't really even finished working out what the question should be.

However, speaking generally, and this is working on the basis you're dealing with unbound ComboBoxes rather than any sort of bound Form, You could have two ComboBoxes (Called [cboName] & [cboID]) with very similar ControlSources and in the AfterUpdate event of both have code that sets the other one to the matching value. Setting a ComboBox to the entry you require basically involves setting the .Value of the ComboBox to the value of the entry.
Apr 23 '19 #3
zmbd
5,501 Expert Mod 4TB
displays ID correspond to that in excel (source).
Also gunjanbhatia48, you need to clarify if this is in an Excel workbook, a linked table within Access to an Excel Workbook, or data imported from excel into an Access database as the method of solution may be drastically different, that is to say, a solution that works for the Excel workbook will not usually be available in Access or vice/versa.
Apr 30 '19 #4

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

Similar topics

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...
2
by: williamyeow | last post by:
Hi i am new to excel VB. can anyone tell me how to link userform to another userform? My concept for my program I have set up a userform with a couple of option. after the user has chose the...
0
by: Maninder Karir | last post by:
Hi, Im not very experienced in using VBA in Excel but im having a go. Im stuck with getting data from another worksheet into a Combobox. Basically I have around 10 worksheets each is a...
3
by: Paulers | last post by:
Hello all, I have been pulling my hair out trying to figure out how to access the selected text in a combobox from another thread. I can get it working with a textbox but it does not with a...
2
by: eihabisaac | last post by:
Hi everyone I'm using VS2005 C# with MySQL to do a windows application i'm also using Devart for MySQL i was able to populate a combobox from the database but i really want to populate...
1
by: sandhya karki | last post by:
I have three combobox for menu ,submenu and subsubmenu. When I click the first combox ,second combobox should be appeared displaying the value related to the first combox box and when i click the...
1
by: corneliussimeon | last post by:
Hi! I have two comboboxs in my windows form application, one of the combobox item were manually inputted. I want to fill the second with items from a database but first the user will first specify...
3
by: bhasky12345 | last post by:
Hi all, I am new to VB. I have to create one Windows Form application where user inputs the data and after the final submission, the entered data is displayed in the form of a word file. So far I...
9
by: Pierkes | last post by:
Hi there, I have a problem with a subform on a mainform. I have; Databases amongst which; tbl_trajecten (including field: ID_traject) tbl_reasons (including field: ID_reason_traject)
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.