Refering to another field in a form and return entries based on the filed

Posted by Claus Machholdt on Super User See other posts from Super User or by Claus Machholdt
Published on 2013-11-13T09:06:26Z Indexed on 2013/11/13 10:01 UTC
Read the original article Hit count: 285

Filed under:
|

Structure of DB is:

Org_Year(Table)

  • ID
  • Org_Name_ID
  • Org_Year

Ft(Table)

  • ID
  • Org_Year_ID
  • Count

Org_Name(Table)

  • ID
  • Org_Name

I've created a form to input data into Ft. Form has reference to Org_name. I should be able to choose between different org first. Afterwards i want to choose which year to enter data into Ft for. I only want to be presented with a list of Years according to the entries in the Org_Year table, where org matches my selection in the dropdown above.

The query to populate the select box (Org_year_Box) is:

SELECT Org_Year
FROM Org_Year
WHERE Org_Name_ID=Organisation_Name_ID.value;

I't doesn't return the Years for the given Org_id when using the above query. But if i replace "Organisation_Name_ID.value" with the actual value ie. "2" it returns the correct years.

How to do?

© Super User or respective owner

Related posts about microsoft-access

Related posts about sql