WS
asked on
MS Access - Filter subform based on date selected in main/parent form
Hello,
I have a form that have multiple listbox with multiple selection and they are filtering subform. Now i want to have filter subform based on date selected in texbox in mainform. VBA code can be use to filter. Also attach is the DB in which frmListBox is the one that have date textbox . When date is selected from that it should filter subform field Timestamp.
Any help would be appreciated.
Thank you.
Wsm93.accdb
I have a form that have multiple listbox with multiple selection and they are filtering subform. Now i want to have filter subform based on date selected in texbox in mainform. VBA code can be use to filter. Also attach is the DB in which frmListBox is the one that have date textbox . When date is selected from that it should filter subform field Timestamp.
Any help would be appreciated.
Thank you.
Wsm93.accdb
ASKER
Wow Gustav , that's amazing, but i came across one more thing if you could sort that related to this. In my operational database i have time also with date,so could you please help me in filtering record as between two dates. In the attach DB i have make changes. If instead of finding the exact date how it could be change as From Date and To Date considering that there are time also with date (We don't need to filter date it's just between two dates and record that in any time between them should filter out).
Thank you again,
Wsm93--1-.accdb
Thank you again,
Wsm93--1-.accdb
You could cut the time part of the stored dates with Fix:
If Not IsNull(Me!Timestamp.Value) Then
strFilter = strFilter & " And Fix(Timestamp) = #" & Format(Me!Timestamp.Value, "yyyy\/mm\/dd") & "#"
End If
/gustav
ASKER
Gustav it's working for time but how to filter between two dates? Example i want to find all records that between 1 August 2017 and 20 August 2017, how that will work?
Wsm93--1-.accdb
Wsm93--1-.accdb
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's not working. It's giving error. Have a look at it.
Wsm93--1-.accdb
Wsm93--1-.accdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Gustav. (y)
You are welcome!
/gustav
/gustav
Open in new window
See attached demo./gustav
Wsm93.accdb