Hello,
I'm working on a form in Access 2007, and specifically on a combo-box field that displays two columns in the drop-down menu. The problem is that once I make a selection, the field only displays one of the two columns in the filled out box (the column on the left). I'd like to have both columns displayed after making a selection. Does anyone how I can achieve that? Thanks in advance.
John
5 5126 patjones 931
Recognized Expert Contributor
Hi,
Combo boxes display a single value after selection. But, I was able to do what you are suggesting by putting this in for the After Update event of the combo box: - Me.cbo.Value = Me.cbo.Column(0) & " " & Me.cbo.Column(1)
The obvious drawback here is that the combo box's actual value will now be whatever the combined columns are, and this is not a good way to design it. If you feel like you must display more than whatever the bound column is, I would drop a text box in next to the combo box and do it there, so as to keep the combo box single-valued.
Pat
@zepphead80
Hey Pat,
Thanks for your response. I did what you suggested (I think), but I received the following message when I then tried to make a selection from the combo-box:
Microsoft Access can't find the object 'Me.'
If 'Me' is a new macro or macro group, make sure you have saved it and that you have typed its name correctly.
I must admit that I know relatively little about Access, so I have no idea what this message is asking me to do. Any idea how to make it read that code correctly? Thanks again.
John
patjones 931
Recognized Expert Contributor
Hi,
Can you post all the code you have so far?
"Me" is just a shorthand way of saying whatever your current database object is (form, report, etc.) When you type "Me.", a list should pop up with various commands you can use in relation to the form, and also all the controls on the form. Also bear in mind that when I wrote "Me.cbo.Value", I was implying that you should replace "cbo" with whatever the name of your combo box is.
Pat
Hey Pat,
Here's the code that I have right now:
Private sub Facility_AfterUpdate()
AfterUpdate.Facility.Value = AfterUpdate.FacilityID.Column(0) & " " & AfterUpdate.FacilityName.Column(1)
End Sub
So the field name for the whole combobox is "Facility," the column on the left is "FacilityID," and the column on the right is "FacilityName."
Also, the two dropdown boxes at the top of the Visual Basic code window are set to "Facility" and "AfterUpdate," if that helps. Thanks again.
John
These lines - AfterUpdate.Facility.Value = AfterUpdate.FacilityID.Column(0) & " " & AfterUpdate.FacilityName.Column(1)
-
need to be - Me.Facility.Value = Me.FacilityID.Column(0) & " " & Me.FacilityName.Column(1)
Linq ;0)> Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rich |
last post by:
I'm sure it sounds kinda nutty to display 200 columns and
500,000 rows of data. But I have been pulling data from a
Lotus Notes database into Sql Server for a while now, but
Lotus Notes is...
|
by: dmiller23462 |
last post by:
Somebody take a look and give me any suggestions? My brain is nuked...
Here's my deal....I have online submission forms on my intranet at
work here....I am appending to an Access DB with the...
|
by: Brian |
last post by:
Hope you all had a great holiday.
I have a subform with a table with a combo box based on a select query. The
combo box is set to display in a form in datasheet view.
When I click the down...
|
by: Rich |
last post by:
I have a form with a combo box on it. The combo box's source is a
access lookup table with two columns, EmployeeName & EmployeeNumber.
I want to display the EmployeeName from the dropdown but...
|
by: Ross Hamilton |
last post by:
Can anyone help me with this small problem.
I have a report that is divided into 3 Columns using the page setup, It
displays the report fields in 3 separate columns (Desc & Pg Num) but it only...
| |
by: Wadim Grasza |
last post by:
I want to store and display (on a form or a report) multiple pictures
per
record in an access database. The pictures are not stored within the
database. They are stored as files and the database...
|
by: Alpha |
last post by:
Hi,
I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a
listbox that I have binded to a dataset table, "source" which has 3 columns.
I would like to display 2 of those...
|
by: Joe Van Meer |
last post by:
Hi,
Is the datalist meant for one table or can I use it to display information
from 2 different tables? Or should I be looking at a datagrid instead?
I began my code and kinda ran into a snag...
|
by: scratchadere |
last post by:
I am tryin to partition a listbox into multiple columns.Here is the real problem.I am getting data from MS ACCESS database.I want to display it juz like how an email account displays unread messages...
|
by: rn5a |
last post by:
A MS-Access DB has 3 tables - Teacher, Class & TeacherClass. The
Teacher table has 2 columns - TeacherID & TeacherName (TeacherID being
the primary key). The Class table too has 2 columns - ClassID...
|
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,...
| |
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...
|
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,...
|
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: 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,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |