MisterChris
New member
- Local time
- Tomorrow, 01:30
- Joined
- Apr 16, 2013
- Messages
- 5
Hellooo,
I have a bit of an issue regarding an inline query in Access 2010 - I am currently using INNER JOIN and GROUP BY to narrow down the RowSource of a combo box based on the value selected in the active combo box where the code is located "onClick".
The value being selected is a StoreID,
This ID is matched against the AssetRegister to find all group names,
The GroupID and GroupName are then retrieved from the AssetGroup table,
then finally the list is grouped on the Group ID and Group Name.
I have tested this query in SQL Server Management Studio and it works without any issues, however when I use it as an inline query to adjust the row source of the combo box it returns no values.
Here is the SQL query:
And here is the inline query applied to the RowSource:
It is possible that this has to do with what is acceptable within Access VB6 script but I don't have the experience to locate the issue.
Please may somebody assist me with this query?
Thank you in advance.
I have a bit of an issue regarding an inline query in Access 2010 - I am currently using INNER JOIN and GROUP BY to narrow down the RowSource of a combo box based on the value selected in the active combo box where the code is located "onClick".
The value being selected is a StoreID,
This ID is matched against the AssetRegister to find all group names,
The GroupID and GroupName are then retrieved from the AssetGroup table,
then finally the list is grouped on the Group ID and Group Name.
I have tested this query in SQL Server Management Studio and it works without any issues, however when I use it as an inline query to adjust the row source of the combo box it returns no values.
Here is the SQL query:
Code:
SELECT AssetGroup.ID, AssetGroup.GroupName
FROM AssetGroup
INNER JOIN
(SELECT AssetRegister.AssetGroup, AssetRegister.Store
FROM AssetRegister
WHERE AssetRegister.Store=7) AS ar ON (ar.AssetGroup = AssetGroup.ID)
INNER JOIN Store ON Store.ID = ar.Store
GROUP BY AssetGroup.ID, AssetGroup.GroupName ORDER BY AssetGroup.GroupName
And here is the inline query applied to the RowSource:
Code:
AssetGroup.RowSource = "SELECT AssetGroup.ID, AssetGroup.GroupName FROM AssetGroup INNER JOIN " _
& "(SELECT AssetRegister.AssetGroup, AssetRegister.Store FROM AssetRegister WHERE AssetRegister.Store=" & StoreID & ") AS ar ON (ar.AssetGroup = AssetGroup.ID) " _
& "INNER JOIN Store ON Store.ID = ar.Store GROUP BY AssetGroup.ID, AssetGroup.GroupName ORDER BY AssetGroup.GroupName"
AssetGroup.Requery
It is possible that this has to do with what is acceptable within Access VB6 script but I don't have the experience to locate the issue.
Please may somebody assist me with this query?
Thank you in advance.
