I expect that this is somewhere in the documentation, but I cant seem to find it. I appolagise if I am asking a stupid question. I am creating a list of jobs to be done in our department, and to populate one of the html tables, I need to get a database column from a query based on a lookup table. In other words I am trying to do something similar to: <dtml-in expr="qryJobType(JOB_TYPE_ID='6')"> This works ok and returns the results where the JOB_TYPE_ID=6. However the JOB_TYPE_ID needs to be retrieved from another query. I have tried: <dtml-in expr="qryJobType(JOB_TYPE_ID='<dtml-var Type_ID-->')"> But this doesnt work. I am assuming that the '' around the dtml-var is trying to treat this literally rather than expand it. I imagine that I have to do something to this to escape it from this action but cant seem to find out what. IF someone could point me in the right direction, I would be very grateful. Please email me any answers as well as posting here as I may not see a response here. Tim Gildersleeve timg@bilk.ac.uk <mailto:timg@bilk.ac.uk>