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

Code to Set Control Source for Bound ComboBox

hello every body
I want to know that is there a way to assign multiple InputMasks to a combo box. I have two combo boxes on same form. value in 1st combo box come from a query and may contain words like "Cap", "Tab", "Inj", "Ampules" etc. I want that 2nd combo box should have above mentioned values i.e "Cap", "Tab", "Inj", "Ampules" at the end of its value.
suppose 1st combo box have value "Cap Indocid" and when I select 2 from 2nd combo box, it should display it as "2 Cap" instead of "2" only and if 1st combo box have "Tab Indocid", 2nd combo box should display it as "2 Tab"..
Jan 1 '12 #1
3 2236
NeoPa
32,556 Expert Mod 16PB
This has absolutely nothing to do with Input Masks.

To get something like this to work you'd need to :
  1. Decide exactly what you want to happen (Your explanation is so short of important detail as to be almost useless). We know almost nothing about the second ComboBox except that it is a ComboBox. Is the string to be added a single word in all cases? Should it be the whole of the value of the first ComboBox? Without knowing what you want to do it is impossible to explain how to do it.
  2. Update the Control Source property for the second ComboBox to add the current value of the first ComboBox (or the first word or whatever you decide) to the end after a space. We have almost no information to work with so I cannot suggest anything of more detail at this stage.
  3. Creat an AfterUpdate event procedure for your first ComboBox which calls a .Refresh of your second ComboBox. This will ensure that the value of the first ComboBox is always reflected in the second.
Jan 2 '12 #2
My first combo box is a bound combo box that populates its value from a query DrugList. It displays complete name of drug as "Cap Amoxil 250 mg" In "Cap Amoxil 250 mg" 'Cap' is the form of drug, 'Amoxil' is the Trade Name and '250 mg' is the strength. My second combo box has a table as RowSourse that have numeric values 2 through 20
I want that first word in the 1st combo box should automatically be added to the value selected in 2nd combo box. I want that in above example if I select 2, it should display as '2 Cap'. suppose Drug form in 1st combo box be 'Tab' and complete value 'Tab Amoxil 250 mg', then on selecting 2 from 2nd combo box , the value displayed in 2nd combo box should be '2 Tab'. Can this all be done by formatting multiple InputMasks to 2nd combo box..???. Hope now you understand my question.
Jan 2 '12 #3
NeoPa
32,556 Expert Mod 16PB
Yousaf Shah:
Can this all be done by formatting multiple InputMasks to 2nd combo box..???.
No. I've already explained that quite fully even though your question didn't make sense. No. Input Masks have nothing to do with what you are asking about. I have already explained what you need.
Yousaf Shah:
Hope now you understand my question.
I understand that part of your question you actually included. What I didn't understand was that part you didn't include in the question.

Now I understand that, for some inexplicable reason, you have chosen to mix up multiple fields of data into the same string values (in your first ComboBox). You have a choice here where you either discover how much more complicated this makes your task of separating out the required element for use later, or you keep the three values in your first ComboBox in three separate columns where you may choose to show all three, but only the relevant one is returned in the value (Bound Column).
Jan 2 '12 #4

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

Similar topics

2
by: Ed via AccessMonster.com | last post by:
Hi all, What I am trying to do is get the value of the second column of a bound combo box in vba. example: Combo box: column 1-ID column 2-SIGN_CODE 1 R-1.gif 2 ...
1
by: Adjo | last post by:
Okay, I've seen all the examples of using comboboxes on webforms when using simple values. And in the issue-tracker starterkit there is a way to use comboboxes with id/value foreign keys in a smart...
1
by: James | last post by:
I am used to VB6 but need to develop something in .Net. I need to create several bound combo-boxes which will use lookup tables to get their values. I created a form using the dataform wizard....
0
by: James | last post by:
I have a bound combo using a lookup table which is behaving as expected with the exception of the first record. In the list of rows for my combo, the first is '.'. This is because of another...
4
by: Evan | last post by:
I have a data bound combo box. The combo box displays several items (status code descriptions). After the combo box is bound, I want to set the combo box so that the "Draft" status is displayed by...
1
by: Bill | last post by:
Problem: Combo box data disappears from view when a requery is done See "Background" below for details on tables, forms & controls On a form, I want to use the setting of bound combo box C1...
9
by: Vmusic | last post by:
Hi, I'm using MS Access 2002. I have a form with a combo box built from a query that returns one column, and that one column is the bound column. How do you use VBA to programmatically change...
3
by: Bill | last post by:
I have what I think should be a simple question regarding a bound combo box. My first table is Dealers: DealerID - primary key DealerName BillToLocation My second table is Locations:...
3
by: kbannon | last post by:
I have come across a problem whereby occasionally a problem occurs with a data bound combo. The combo has an event which when changed causes a second combo to populate (its also data bound)....
1
by: zufie | last post by:
Why does my Bound Combo Box not allow me to select a value from its list of values? Many Thanks!, John
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: 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: 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:
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
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.