Solved

drop down field

Posted on 2011-03-06
8
431 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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 500 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

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