Can I do this in a Query

doggo

Board Regular
Joined
Jan 22, 2004
Messages
115
Hi,

I am trying to condition a field dependant on the key field value. Here is some example data

TBL1
LINE____VERSION
A_________1.2
B_________1.4
C_________2.0

TBL2
LINE____VERSION
A_________1.2
A_________1.1
A_________1.0
B_________1.4
B_________1.2

So What I am trying to do is make the VERSION field in TBL1 only bring back valid VERSIONS from TBL2 in datasheet view. So when I click on the drop down for the Line A in TBL1 - I can only choose 1.0,1.1,1.2

Any ideas?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Depends how you want to use the data. If you need to be able to pick a VERSION from Table1 and see corresponding values from Table2, you need a form / subform setup.
If you are going to pick a value and then use the matching data for e report, a query could be the way to go.

Denis
 
Upvote 0
You could build a parameter query.
1. Build a query using all the fields from Table 2
2. In Design view, click in the Criteria row of the Version field and type a prompt in square brackets, eg: [Which version do you want to see?]
Every time you run this query, the parameter popup dialog appears. Enter your version and you'll get the result.
There are other ways, based on forms, but this is the quickest to set up.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,771
Messages
6,161,847
Members
451,723
Latest member
Rachetsely

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top