Hi,
I have a table Branches and I want to update it with the result of a query.
Is it possible? Here is what I've done:
Private Sub GetData_Click()
Dim SQL As String
SQL = "UPDATE Branches " & _
"SET Branches.[A Outlets] = d.[SumOfA]" & _
"Where (((Branches.[BranchId]) = " & Me.Text86 & "));"
DoCmd.RunSQL SQL
End Sub
d is the name of the query
The query is this:
SELECT Sum(CityMarket.[A Outlets]) AS SumOfA
FROM CityMarket
WHERE (((CityMarket.BranchId)=[Forms]![RegBranch]![RegBranch1].[Form].[BranchId]));
I have a table Branches and I want to update it with the result of a query.
Is it possible? Here is what I've done:
Private Sub GetData_Click()
Dim SQL As String
SQL = "UPDATE Branches " & _
"SET Branches.[A Outlets] = d.[SumOfA]" & _
"Where (((Branches.[BranchId]) = " & Me.Text86 & "));"
DoCmd.RunSQL SQL
End Sub
d is the name of the query
The query is this:
SELECT Sum(CityMarket.[A Outlets]) AS SumOfA
FROM CityMarket
WHERE (((CityMarket.BranchId)=[Forms]![RegBranch]![RegBranch1].[Form].[BranchId]));