Solved

Fields in Access

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

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
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.

726 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