Link to home
Start Free TrialLog in
Avatar of Gary Croxford
Gary CroxfordFlag for United Kingdom of Great Britain and Northern Ireland

asked on

MS Access Report Get Value From Another Query

Thank you for looking at my question,

I have a report in MS Access comparing inventory and consumption that pulls from one query but I would like to pull one item in the report header , the date the inventory data was captured, from another query.

The inventory date is the only item in a query called qryInventoryDate

and in the data source property for the textbox I hoped would display this value I had typed a select query

= SELECT [qryInventoryDate]![Inventory Date] from [qryInventoryDate]


but when I try to run the report it is prompting me for a parameter value for inventory date.

Can I get this data to display in the header of my report and if so how do I achieve that please?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A query returns a recordset which is different from a single value.  That is why you can't just stick SQL expressions in controls.  Rey's suggestion of a DLookup() would work.  I'm pretty sure that Access is smart enough to run the query only once.  An alternative is to add the qryInventoryDate query to your RecordSource query.  No join lines.  This makes a Cartesian Product but since this is a report, it doesn't matter.  That way the column would be in the recordsource and you would just bind a control to it.
Avatar of Gary Croxford

ASKER

Rey, worked perfectly, thank you