vishalsomani,
Since this is an assignment I will not give you a full answer to your question, that is against the rules of this forum. However, I will give you the SQL queries to get the data you want since you could easily get those through Access anyway.
Here goes:
For the first problem of yearly sales per supplier you can use the following query to get your data:
SELECT Orders.SupplierID,
Suppliers.CompanyName,
Sum([Quantity]*[UnitPrice]) AS TotalAmt,
Count(Orders.OrderID) AS CountOfOrderID
FROM Orders LEFT JOIN Suppliers ON Orders.SupplierID = Suppliers.SupplierID
WHERE Year([OrderDate])=2003
GROUP BY Orders.SupplierID, Suppliers.CompanyName;
What you need to do here is to replace the year, i.e. 2003, with the year you are interested in when you build the query in your code, something like:
Dim SQLString As String
SQLString = "SELECT Orders.SupplierID, Suppliers.CompanyName, Sum([Quantity]*[UnitPrice]) AS TotalAmt, Count(Orders.OrderID) AS CountOfOrderID "
SQLString = SQLString & "FROM Orders LEFT JOIN Suppliers ON Orders.SupplierID = Suppliers.SupplierID "
SQLString = SQLString & "WHERE Year([OrderDate])= " & Inputbox("Please enter the year for the annual report:")
SQLString = SQLString & " GROUP BY Orders.SupplierID, Suppliers.CompanyName"
For the second problem, of getting orders above a certain amount you should use the following query:
SELECT Orders.OrderID,
Orders.Product,
Orders.UnitPrice,
Orders.Quantity,
[Quantity]*[UnitPrice] AS TotalAmt,
Orders.OrderDate,
Orders.Received,
Orders.SupplierID,
Suppliers.CompanyName
FROM Orders LEFT JOIN Suppliers ON Orders.SupplierID = Suppliers.SupplierID
WHERE [Quantity]*[UnitPrice] >= 1000;
Here the trick is to get the total amount above which the users are interested you can use the same technique as above and then the code would look something like this:
Dim SQLString As String
SQLString = "SELECT Orders.OrderID, Orders.Product, Orders.UnitPrice, Orders.Quantity, [Quantity]*[UnitPrice] AS TotalAmt, Orders.OrderDate, Orders.Received, Orders.SupplierID, Suppliers.CompanyName "
SQLString = SQLString & "FROM Orders LEFT JOIN Suppliers ON Orders.SupplierID = Suppliers.SupplierID "
SQLString = SQLString & "WHERE [Quantity]*[UnitPrice] >= " & InputBox("Please enter the order total to report on:")
If you want to use other ways of getting the variable input into your queries just replace the InputBox() statements with your variables and everything should work OK.
Hope this helps
Happy coding
Yomet