Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Fields in Access

Posted on 2013-01-29
5
Medium Priority
?
185 Views
Last Modified: 2013-01-29
I am gussing this is pretty easy, but I a idiot with Access.

I have a two column table with Column A and B.

In a form in access, I would like a combo box that has all the options in Column A of the table.

I think want another text box (or field of some sort) that will give the Column B result based on what was chose in the combo box based on Column A.

Any ideas? Thanks!
0
Comment
Question by:cansevin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38832216
Look at sample
DBColumns.accdb
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 38832235
We like idiots.  Especially the kind that works with us and assignes points well.  

>In a form in access, I would like a combo box that has all the options in Column A of the table.
Here's how I would pull this off (others' styles may vary, and you may choose an easier route)
(1)  Create a query with that table and your two columns, with any special sorting or handling.

The SQL would go something like this:
SELECT ColumnA, ColumnB FROM YourTable ORDER BY WhateverSortYouWant

Save the query, and give it a name.  I usually prefix queryies that feed combo boxes with qcbo_.

(2)  In your form's design view left-click on a combo box in the toolbox, then left-click-and-hold in the form where you want the combo box's upper left corner to be, drag to where you want the lower right corner to be, and unclick.

(3)  Changes these properties in the combo box:
Name      Give it a name
Row Source, name of the query in (1)
Column Count, 2
Bound Column, 1
Column Widths, 1"; 2" {or whatever fits the data}

>I think want another text box (or field of some sort) that will give the Column B result based on what was chose in the combo box based on Column A.
(4)  Create a separate text box.
(5)  In the Control Source of the text box, type this -->  =ComboBoxName.Column(1)
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38832299
Just so you understand Jim's last line (no points)

The ComboBox can obviously contain multiple columns, at least one of which must have a non-zero column width (othewise no data will be displayed).

However the Column() collection of the combo box  is zero based (first column has a value of 0), therefore Column(1) refers to the 2nd column of the query that the combo is based upon.

Confusingly, the Bound column is the column whose data Access will actually store if the combo is bound to another table.  That column is NOT zero based, so:

Bound Column: 1

means just that, the first column in the query.  Normally this would be the Primary Key of the table being used as the Combo's rowsource.
0
 

Author Closing Comment

by:cansevin
ID: 38832483
Thanks, that worked great. I appreciate the help!
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38832490
Thanks for the grade, but did als's sample help?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question