Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Refer to Current Record in SQL

Author  Topic 

ahmadmahrous_1
Starting Member

4 Posts

Posted - 2012-07-16 : 12:37:40
Consider those two tables in Access 2010:

ActionReg
=========
ActionID Taskt1 Actiont1
1 t1 t1a1
2 t2 t2a1
3 t3 t3a1
4 t1 t1a2
5 t1 t1a3
6 t2 t2a2

TaskReg
=========
ActionID Taskt2 Actiont2
1 t1
2 t2
3 t3

I give the field Actiont2 the following properties (in Lookup tab in Design View):

- Display Control = ListBox
- Row Source Type = Table/Query

Now I want this query to retrive from Actiont1 into Actiont2 the records related only to the value of Task2 so the result will be:

TaskReg
=========
ActionID Taskt2 Actiont2
1 t1 (t1a1,t1a2,t1a3)
2 t2 (t2a1,t2a2)
3 t3 (t3a1)

I used:

SELECT ActionReg.Action1
FROM ActionReg, TaskReg
WHERE [ActionReg]![Task1]=[TaskReg]![Task2];


But it retrives all records in Action1 if Task1 = any record in Task2.
   

- Advertisement -