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
 How?Pass current record ID into RowSource property

Author  Topic 

pyrrhus_finch
Yak Posting Veteran

51 Posts

Posted - 2005-03-15 : 12:34:06
I think this is an easy one, but I can't seem to find an example.

Right click on my Listbox> Select 'Data' TAB

on 'RowSource' I have my Query writen:

Select ID, Dept_Name from tblDepartments WHERE tblDepartment.ID IN (SELECT Dept_ID from tblNotification WHERE Incident_ID = 1 and Incident_Type = 'Complaint');

Works fine, EXCEPT ... I need to make the '1' equal the current record ID or the value in txtID box on the form - the former would be best.

So how do I write parameter like this into that string? Without having to set the Value in the onload event in Code.

Seems like it should be something like:
Select ID, Dept_Name from tblDepartments WHERE tblDepartment.ID IN (SELECT Dept_ID from tblNotification WHERE Incident_ID = [form.currentrecord] and Incident_Type = 'Complaint');

???

Thanks!

pyrrhus_finch
Yak Posting Veteran

51 Posts

Posted - 2005-03-15 : 12:47:32
Seems like it should be something like:
Select ID, Dept_Name from tblDepartments WHERE tblDepartment.ID IN (SELECT Dept_ID from tblNotification WHERE Incident_ID = FORM.txtID and Incident_Type = 'Complaint');

this worked. but let me know if there's another way. Thanks. = )
Go to Top of Page
   

- Advertisement -