473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Microsoft Access Query

Hey guys, sorry for not being active on here, just been really busy with work.

So, I'm doing my ICT GCSE Project which is a database. It is basically a database containing data for a video game store. It has 4 tables; tblOrder, tblCustomer, tblProduct and tblSupplier.

So I've successfully made 2 queries so far which show all the orders between 2 user inputted dates. The other query shows any video games which have a stock level below 10 but are not preowned games.

I now have this new idea. I wish to create a query which would search for any members who have not purchased a game from the store within the past 3 months, from the current date. I have my relationships right but I have no idea how to go about doing this. In my orders table I do have things like Order ID and Order Date. The Orders table also contains a Cust ID which is linked with the Cust ID from the customer table. So I need my query to only show members who have not purchased a game within the past 3 months, from the date that the query is ran.

Can anyone please shed some light on the type of criteria I am supposed to use? Please just keep it simple and effective, I don't want to have to learn a new programming language just to create a silly query.

Thanks.

I've scoured the internet and found this criterion I can use. >=DateAdd("m",-3,Date())

This, basically shows me all the records which are in the past 3 months. What I need is the records showing, which are not, in the past 3 months. But I also need this to be linked to the customer, in the way that I explained above. If I did it this way, what if a customer bought a game in both time periods? So it is quite a tricky query this is, so I would appreciate some guidance.

Okay, by simply switching the ">" sign around, I managed it to get it to show me all of the records, NOT in the past 3 months. Now I need it to show me the customers who have NOT ordered a game in the past 3 months. It is quite tricky because some customers may have ordered in both time periods. Basically right now its showing me a load of inactive orders. I need a list of inactive customers.
Oct 11 '10 #1
1 1500
NeoPa
32,556 Expert Mod 16PB
You would need first to connect up your [Customer] and [Order] tables with a LEFT JOIN.

Next ensure the query is has a GROUP BY clause specifying to group on the Customer Account.

Your HAVING clause would then exclude any groups where the Max() of the [Order Date] is either Null or greater than a date of three months ago. Something like :
Expand|Select|Wrap|Line Numbers
  1. HAVING Nz(Max([Order Date]), #1/1/1900#) > DateAdd('m', -3, Date())
Oct 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Puneet Murgai | last post by:
I am trying to run an access query which works when I write it directly in the database. However, it fails when an SQL script containing it is run from C++. It doesn't recognize the Iff and Nz...
7
by: Rob Richardson | last post by:
Greetings! I am rewriting a VB6 application in VB .Net. The database (which was converted from Access 97 into Access 2000) has two nearly identical queries. One, called GetNewOrderNumber, is: ...
5
by: Art | last post by:
Hi, Can anyone point me to an example of how I would execute a query I've created in an Access DB. I've copied the SQL down to my VB.net application and that works fine, but it's ugly. I'd like...
1
by: bbdobuddy | last post by:
Hi I have a couple of questions 1. can I run a Microsoft Access Query Progamatically from VB.net. If so, how? 2. can I get access to that query and pull specific pieces of data. If so,...
0
by: shapper | last post by:
Hello, I have the tables content and content_localized in a Microsoft Access database. I created a Query in my Microsoft Access database named "content_SELECT": SELECT...
3
by: wizcode | last post by:
It is possible to create a multiple report in one query, example in the queries you have a 10 records and their is one unique field and in that unique field the query will base and every records have...
3
by: =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= | last post by:
Has anyone successfully used an Access query from .NET? I am trying to do this and am getting a weird error. .NET calls queries 'stored procedures'. The error I am getting says "Schema could not be...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
24
by: goalv | last post by:
Hi friends I am bit new to access , I want to make query for data which has not happened after repeated attempts...can any one help me I have following tables DATE STORE ID DATE...
1
by: Ken Jones | last post by:
I really appreciate the help you guys have been giving me! What would be really helpful now is if you could recommend a really good Microsoft Access Query Reference Manual that would explain to me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.