Solved

Fields in Access

Posted on 2013-01-29
5
178 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
5 Comments
 
LVL 39

Expert Comment

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

Accepted Solution

by:
Jim Horn earned 500 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 47

Expert Comment

by:Dale Fye (Access MVP)
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 65

Expert Comment

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

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now