looking887
Technical User
I am relatively new to access and have a question on a form that I have been struggling with. Below you will find the SQL of the query I am using. My primary form "ExpensesTest" is using the fields YearNumber, Months, and CategoryName. What I am trying to do is set the 3 fields above, and then list by Dollar amount the expenses for that Month and Category selected. In other words, select the category and date once without repeating these entries each time I enter an expense. Then, if I want to change the category/Month, I do it once and then enter all appropriate expenses with the dollar amount.
I thought that a subform would be the way to go but when I go to a new record, my list of previously entered expenses appears rather than a clean subform. Is this the right way that I should be doing this and if so, can you perhaps give me some guidance.
QUERY for ExpensesTest Form
SELECT tblExpenses.ExpenseID, tblExpenses.ExpenseAmount, tblExpenses.CategoryID, tblExpenses.MonthID, tblExpenses.YearID, tblCategories.CategoryName, tblMonths.Months, tblYears.YearNumber
FROM tblYears RIGHT JOIN (tblMonths RIGHT JOIN (tblCategories RIGHT JOIN tblExpenses ON tblCategories.CategoryID = tblExpenses.CategoryID) ON tblMonths.MonthID = tblExpenses.MonthID) ON tblYears.YearID = tblExpenses.YearID;
SQL for subform
SELECT qryExpenses.ExpenseID, qryExpenses.ExpenseAmount, qryExpenses.CategoryID, qryExpenses.MonthID, qryExpenses.YearID
FROM qryExpenses;
I thought that a subform would be the way to go but when I go to a new record, my list of previously entered expenses appears rather than a clean subform. Is this the right way that I should be doing this and if so, can you perhaps give me some guidance.
QUERY for ExpensesTest Form
SELECT tblExpenses.ExpenseID, tblExpenses.ExpenseAmount, tblExpenses.CategoryID, tblExpenses.MonthID, tblExpenses.YearID, tblCategories.CategoryName, tblMonths.Months, tblYears.YearNumber
FROM tblYears RIGHT JOIN (tblMonths RIGHT JOIN (tblCategories RIGHT JOIN tblExpenses ON tblCategories.CategoryID = tblExpenses.CategoryID) ON tblMonths.MonthID = tblExpenses.MonthID) ON tblYears.YearID = tblExpenses.YearID;
SQL for subform
SELECT qryExpenses.ExpenseID, qryExpenses.ExpenseAmount, qryExpenses.CategoryID, qryExpenses.MonthID, qryExpenses.YearID
FROM qryExpenses;