Update query help

M

Mikael

I'm building a database aimed at handling subscriptions, it will be used on
the side of our business system.
I want to update a table (own databasee) with date() where the date of the
last subscription invoice (from business database) is less or equal to
date()-365.
I get an error however that I can't translate properly to english,. It says
something like this:
....Function not allowed in where instruction (could be aggregatefunction but
im not sure)

SQLCode:

UPDATE (Hemsida INNER JOIN [P:\ftg1\Kund] ON Hemsida.Nummer =
[P:\ftg1\Kund].Nummer) INNER JOIN [P:\ftg1\Prodtrans] ON
[P:\ftg1\Kund].Nummer = [P:\ftg1\Prodtrans].KundLevnr SET
Hemsida.Abb_Utgått_mail = Date()
WHERE (((Last([P:\ftg1\Prodtrans]![Datum]))<=Date()-365) AND
(([P:\ftg1\Prodtrans].Produktnr)="97-966009" Or
([P:\ftg1\Prodtrans].Produktnr)="97-966109" Or
([P:\ftg1\Prodtrans].Produktnr)="97-966309" Or
([P:\ftg1\Prodtrans].Produktnr)="97-966209"));
 
V

Van T. Dinh

You cannot use the Last() aggregate function in the WHERE clause.

Try using the domain aggregate function DMax() instead.

Check Access Help on DMax() syntax and usage.
 

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