473,505 Members | 15,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display two columns in Access

7 New Member
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
Apr 28 '10 #1
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:

Expand|Select|Wrap|Line Numbers
  1. 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
Apr 28 '10 #2
nedryerson
7 New Member
@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
Apr 29 '10 #3
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
Apr 29 '10 #4
nedryerson
7 New Member
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
Apr 29 '10 #5
missinglinq
3,532 Recognized Expert Specialist
These lines

Expand|Select|Wrap|Line Numbers
  1. AfterUpdate.Facility.Value = AfterUpdate.FacilityID.Column(0) & " " & AfterUpdate.FacilityName.Column(1)
  2.  
need to be

Expand|Select|Wrap|Line Numbers
  1. Me.Facility.Value = Me.FacilityID.Column(0) & " " & Me.FacilityName.Column(1)
Linq ;0)>
Apr 29 '10 #6

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

Similar topics

32
4119
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...
4
1787
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...
2
10582
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...
1
2574
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...
2
3371
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...
12
20855
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...
18
3321
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...
4
2472
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...
2
3512
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...
4
2407
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...
0
7216
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
7098
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
7303
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
7471
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...
0
5613
agi2029
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,...
0
3187
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
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...

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.