Solved

Fields in Access

Posted on 2013-01-29
5
180 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views 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 Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

785 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