A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL Statement



 
 
Thread Tools Display Modes
  #1  
Old June 30th, 2008, 04:41 PM posted to microsoft.public.access.queries
Joe Gonzalez
external usenet poster
 
Posts: 3
Default SQL Statement

I have a table of just months and years for example:
2008-01
2008-02
2008-03
2008-04
2008-05
2008-06

And I have another table that is storing data that contains the date of say
2008-05.

I have a form with a drop down that displays the dates in the first table
but I want to only show dates that are not in the second table (the data
table) so for example since 2008-05 is in the data table I only want the drop
down to show
2008-01
2008-02
2008-03
2008-04
2008-06

I built the drop down as a row source and am trying to add it to a "SQL
Statement: Query Builder"

Any suggestions?

  #2  
Old June 30th, 2008, 05:09 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default SQL Statement

USe the unmatched query wizard to display what you want.

It should build a query that looks like the following.

SELECT Table1.YearMonth
FROM Table1 LEFT JOIN Table2
ON Table1.YearMonth = Table2.YearMonth
WHERE Table2.YearMonth is Null



John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Joe Gonzalez wrote:
I have a table of just months and years for example:
2008-01
2008-02
2008-03
2008-04
2008-05
2008-06

And I have another table that is storing data that contains the date of say
2008-05.

I have a form with a drop down that displays the dates in the first table
but I want to only show dates that are not in the second table (the data
table) so for example since 2008-05 is in the data table I only want the drop
down to show
2008-01
2008-02
2008-03
2008-04
2008-06

I built the drop down as a row source and am trying to add it to a "SQL
Statement: Query Builder"

Any suggestions?

  #3  
Old June 30th, 2008, 06:18 PM posted to microsoft.public.access.queries
Joe Gonzalez
external usenet poster
 
Posts: 3
Default SQL Statement

PERFECT!!Thank you!

"John Spencer" wrote:

USe the unmatched query wizard to display what you want.

It should build a query that looks like the following.

SELECT Table1.YearMonth
FROM Table1 LEFT JOIN Table2
ON Table1.YearMonth = Table2.YearMonth
WHERE Table2.YearMonth is Null



John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Joe Gonzalez wrote:
I have a table of just months and years for example:
2008-01
2008-02
2008-03
2008-04
2008-05
2008-06

And I have another table that is storing data that contains the date of say
2008-05.

I have a form with a drop down that displays the dates in the first table
but I want to only show dates that are not in the second table (the data
table) so for example since 2008-05 is in the data table I only want the drop
down to show
2008-01
2008-02
2008-03
2008-04
2008-06

I built the drop down as a row source and am trying to add it to a "SQL
Statement: Query Builder"

Any suggestions?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.