CodexBloom - Programming Q&A Platform

how to bind a subform to a complex query in MS Access 2019 - 'The record source specified does not exist'

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-13
ms-access vba subform SQL

I'm upgrading from an older version and I'm relatively new to this, so bear with me. I'm working with an scenario when trying to bind a subform to a complex query in MS Access 2019. The main form is based on a simple table, and the subform should show related data from a query that joins multiple tables. However, when I set the subform's Record Source to the complex query, I receive the behavior message: 'The record source specified does not exist'. The query itself works perfectly when run in the query designer and returns results as expected. Here's the SQL for the query I am trying to use: ```sql SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Orders.OrderDate > DateAdd('m', -6, Date()) ORDER BY Orders.OrderDate DESC; ``` I've defined the subform control in the main form and set its `SourceObject` property to point to the name of the subform. In the properties of the subform, I have set the Record Source to the above SQL query. I also checked the control source of the fields in the subform to ensure they map correctly to the query fields, but the behavior continues. I have tried the following troubleshooting steps: 1. I verified that the subform is not closed or hidden when the main form is opened. 2. I attempted to re-create the subform and re-link it, but the scenario remains. 3. I also checked for typos in the query and ensured that there are no issues with missing references or data types. Is there a specific limitation or requirement when using complex queries as a Record Source for subforms in MS Access? Any help would be greatly appreciated as I need to display this data dynamically in my application. I'm working on a web app that needs to handle this. Could someone point me to the right documentation? Thanks for any help you can provide! This is for a microservice running on Linux. Has anyone dealt with something similar?