FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,364
- Office Version
- 365
- 2016
- Platform
- Windows
I have a form with the record source set to a table. All works good, but I need to filter the form.
On the property sheet I changed the record source to
and again it works fine and filters the form to only records with meet the criteria of "Food".
Here's where I get stuck. I would like to set the record source thru cmd buttons on a main navigation form.
I have two cmd buttons on that main navigation form, cmdFood and cmdDrink.
I would like when I click cmdFood the record source for the form (frmData) to be the SQL above, but when cmdDrink is clicked the SQL record source changes to
I know this can be done thru a query, but I would like to just use SQL if possible.
On the property sheet I changed the record source to
Code:
SELECT tblData.ID, tblData.[Hire Date], tblData.[Expire Date], tblData.Clasification FROM tblData WHERE (((tblData.Clasification)="Food"));
and again it works fine and filters the form to only records with meet the criteria of "Food".
Here's where I get stuck. I would like to set the record source thru cmd buttons on a main navigation form.
I have two cmd buttons on that main navigation form, cmdFood and cmdDrink.
I would like when I click cmdFood the record source for the form (frmData) to be the SQL above, but when cmdDrink is clicked the SQL record source changes to
Code:
SELECT tblData.ID, tblData.[Hire Date], tblData.[Expire Date], tblData.Clasification FROM tblData WHERE (((tblData.Clasification)="Drink"));
I know this can be done thru a query, but I would like to just use SQL if possible.