By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

Delete Query - Criterion in unrelated table

P: n/a
How can I delete records from a table with a criterion that depends on a
value in an *unrelated* table? In other words, something like:

DELETE tblPortfolioHistory.*
FROM tblPortfolioHistory
WHERE (((tblPortfolioHistory.Date)=[tblGlobals].[RecordDate]));
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Tim Tabor" <tl*****@nyc.rr.com> wrote in message
news:Vt*********************@twister.nyc.rr.com...
How can I delete records from a table with a criterion that depends on a
value in an *unrelated* table? In other words, something like:

DELETE tblPortfolioHistory.*
FROM tblPortfolioHistory
WHERE (((tblPortfolioHistory.Date)=[tblGlobals].[RecordDate]));


Tim, it's not completely clear what you are trying to accomplish, but, if
I'm interpreting correctly, you need to use a subquery:

DELETE FROM tblPortfolioHistory
WHERE tblPortfolioHistory.Date IN
( SELECT RecordDate FROM tblGlobals
WHERE Field = 'Value' )

The subquery returns a set of dates, based on it's criteria. Records with
matching dates in tblPortfolioHistory will be deleted.

Incidentally, it's not a good idea to use "Date" as a field name, or the
name of a control. Anything that represents a keyword in Access, such as
Date, Time, Timer, Count, Sum, etc, should be avoided.

Randy
Nov 13 '05 #2

P: n/a

"Randy Harris" <ra***@SpamFree.com> wrote in message
news:ty**********************@newssvr28.news.prodi gy.com...

Incidentally, it's not a good idea to use "Date" as a field name, or the
name of a control. Anything that represents a keyword in Access, such as
Date, Time, Timer, Count, Sum, etc, should be avoided.


Thanks Randy. I'm new to Access - old habits die hard. This appears to be
the current list of reserved words:
http://support.microsoft.com/default...roduct=acc2003

Tim
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.