I am trying to write a very simple program to count a number of entries, using user specifyed variables in an Access database. I know essentially the code to do it, but things like variables and that elude me.
This is essentially the program i want to make, with things in brackets being userdefined and things in square brackets being variables.
Code:
[Item] = SELECT PurchaseItems.ItemCode FROM PurchaseItems WHERE PurchaseItems.Description = (Item Name)
[DateRange] = SELECT TicketHeader.Code FROM TicketHeader WHERE TicketHeader.Date BETWEEN (StartDate) AND (EndDate)
Output SELECT COUNT(*) AS TotalCount FROM TicketDetail WHERE TicketDetail.ItemCode = [Item] AND TicketDetail.HeaderCode = [DateRange]
so on the last line i want to count the numbe of entries in TicketDetail (a table in the database) where the ItemCode is equal to the (single) ItemCode i returned on the first line, and the HeaderCode is equal to one of the values in [DateRange] of which there will be many
Any help making this into a proper program, which i need to do soo, would be hugely appreciated
|