Using Subqueries within Update Queries

M

MGalyardt

What is the syntax for creating an update query with the new information as a
subquery calculation. This is what I have in the SQL statement, but an error
message keeps coming up:

UPDATE DISTINCTROW [Commuter Sales] SET [Commuter Sales].[Dena Daily Sales]
= (SELECT DISTINCTROW Count(*) AS [Daily Sales]
FROM [Commuter]
WHERE ((([Commuter].[Purchase Date])=Date()) AND
(([Commuter].[Cashier])="DENA")));
 
S

Steve Schapel

MGalyardt,

You could try it like this...
UPDATE [Commuter Sales] SET [Commuter Sales].[Dena Daily Sales]
= DCount("*","Commuter","[Purchase Date]=Date() AND [Cashier]='DENA'")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top