Solved

Fields in Access

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

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 66

Expert Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

687 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