I'm working with a form in Access 2010 that lets the user enter data into the following fields:
Date classroom #of children #of Techers
The user will be entering this data everyday. I already have the form built as a datasheet view form. Also, I have a main window where I have a few tabs having subforms. The above datasheet form is inside of one of these tabs.
Now, I would like to have two text boxes and a search button on the main window for the user to enter a Begin date and a end date so the user can look a date range and filter the datasheet subform.
I tried making these boxes and so far I'm able to filter the datasheet form.... I created a search button with the following code on it:
Private Sub RefreshButton_Click()
Private Sub Search_Date_Click()
.Filter = "[Date] BETWEEN #" & Me.BeginDate & "# AND #" & Me.EndDate & "#"
.FilterOn = True
Me.BeginDate.Value = ""
Me.EndDate.Value = ""
The line where the BETWEEN code is filters the datasheet form and the lines with .Value codes clears up the text boxes when the user hits the search button. So far at this point the search is doing what I need. However, When I get the date range and I have the datasheet form filtered I can not have this datasheet form reloaded or refreshed. I have to close the form totally and reopen it for me to see everything again and be able to do another date range search.
I would like to create a button so the user can hit it and reload the datasheet subform after having the results from the date range search. This way the user can create another date range search all over again. I just don't know how to code it!! Could you give me a hand with this?
Also, I would like to create a button that when it is hit it will create a report with the results I get from a date range search. For example, Begin date 3/4/2011, end date 6/5/2011 and I get the results in the datasheet subform..... then having the results I would hit the create report button and it will create a report out of the results.
Do you think this might be possible? How would I code it?
Any help will be very appreciate!!