Hello,
I’m trying to create a form with a list box that I can use to filter by one field (“Store”) and have all transactions involving that store displayed in a subform. I was trying to use FrugalComputerGuy’s youtube tutorials (View by Department pt.1 and the next video), however I get stuck early on where he creates a table that lists the Filter-ID and Department-ID.
If I’m understanding his tutorial correctly, I’m going to need to assign a “StoreID” to each Store. I am able to create a query that provides a unique and sorted list of Stores, however I don’t know how to assign each store an ID or unique value.
I’ve looked at using variations of ROW_NUMBER() OVER(), and thought about calculating the ASCII value of the letters in the Store field, but haven’t had any success.
Details of my database:
- The data is in table “Transactions”
** the primary key is “PID” - The field is called “Store”, and contains data like Walmart, Target, etc.
** some stores are listed multiple times
** this is not a static field as new stores are entered occasionally - Data is entered into a form called “New_Transactions”
** There is a combobox on this form for “Store” where a new store might be entered (Costco)
** there are many other fields on this form pertaining to the transaction (Cost, Date, etc.)
Query to create a sorted list of unique stores:
SELECT
“Store”
FROM
“Transactions”
GROUP BY
“Store”
ORDER BY
“Store” ASC
How can I add another field (StoreID) to that query with a unique identifier? Should I be taking a different approach? Thanks!