[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

drop down field

Posted on 2011-03-06
8
Medium Priority
?
442 Views
Last Modified: 2012-05-11
I have 2 tables with a one to many relationship in Access 2007
With form entry I want one of the tables to have adrop down list of values to select from the other table of same field.

How do i set up the form field to link to anthor table and display values to select from?
0
Comment
Question by:jagguy
[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
8 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35045949
Open the table in design view, select the field that you want to have the drop down.
Then click Lookup tab. Select Combo box in Display Control.

RowSource type: Table/Query
Row Source: The name of your table.


When you put that field into the entry form, it will create a combo box that looking up the data of the table you specify.


sincerely,
Ed
0
 

Author Comment

by:jagguy
ID: 35045959
ok i get that.

what i also need is when i select a value from drop down box , I want another associated  field to display.

For example I might select Item ID from a combo box and I want the Item name to also appear somewhere whenever i select an item ID (the ItemID and name is defined in another table of course)
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35045973
You may try to use this vba:

At the after update event of the combo box

Me.YourFieldName = DLookUp("YourItemName","tblYourTableName","[ItemID] = & Nz(Me.cboNameOfCombo,0) ")

Ed
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35046029

Try to use this instead:

Me.ItemName = DLookUp("ItemName",YourTable","[ItemID] = Nz(cboName,0)")

ItemName = the fieldname of Item Name
YourTable = name of your table where ItemID and ItemName are found
ItemID = the ItemID field
cboName = the name of your combo box

Ed
0
 

Author Comment

by:jagguy
ID: 35046033
i dont want VBA code so is there another way i could do it?
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35046064
You can create a subform and set the Link Master Fields and Link Child Fields Properties to ID and ItemID.

But, I suggest to use the VBA and just invest some of your time on it. It is always nice to learn something new.

Ed
0
 
LVL 2

Expert Comment

by:wobblynut
ID: 35046079
On the form control  where the id dropdown is (say called cmbID)
set the rowsource to SELECT table2.ID, table2.name FROM table2;
set bound column =1
column count=2
column widths 2.5,0

Set the control source on the form's control where you want the name to appear to =[cmbID].[column](1)

0
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 2000 total points
ID: 35047146
Put the other field you want to display in the combo box's row source, and then use something like this as the control source of an unbound and locked textbox:

=[cboSelect].Column(2)

Column numbering is zero-based, so this refers to the 3rd column.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

656 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