473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

MS Access Filter Report by Selection (Add Date Range Fields)

14
Hello! I am using Access 2010 and I have an Unbound Form (FrmFilter) that filters a report by (up to) 7 criteria using the code below, which works beautifully. I would like to add 2 additional unbound date fields to filter by as well to see only the specified date range in the report:
Start & End Date, both filtering the field "dteAuditDate".
These would be Filter8 & Filter9.

I've tried adding to the following code but I'm doing something wrong because the date filter overrides the other 7 criteria every time I click Run Report or it doesn't work at all.

Can someone help me update my code to add two fields to get a Date Range as well as any of the 1-7 of the selections made?

Code below is for Filters 1-7 only. I would like to add 8 & 9 as Start & End Date for the "dteAuditDate" field.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Set_Filter_Click()
  2.     Dim strSQL As String, intCounter As Integer
  3.  
  4.    For intCounter = 1 To 7
  5.       If Me("Filter" & intCounter) <> "" Then
  6.  
  7.          strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And  "
  8.       End If
  9.            Next
  10.  
  11.         If strSQL <> "" Then
  12.         ' Strip Last " And ".
  13.           strSQL = Left(strSQL, (Len(strSQL) - 5))
  14.           Reports![rptData].Filter = strSQL
  15.           Reports![rptData].FilterOn = True
  16.         End If
  17. End Sub
I am able to create a form that filter solely on date ranges but I need the function integrated into the unbound form I already have. However, I'm not opposed to possible solutions other than adding to this code as long as it will filter the report both on Date Range provided & the other 7 available selections. Thanks so much in advance.

LB in GA
Oct 24 '13 #1
0 6912

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: arthur-e | last post by:
I can filter a query for a report on a field of a subform BUT now.... I'd like to be able to select more than one item in a multi-list box to select all the records. ALSO to use two fields (or...
2
by: Sara | last post by:
I have followed instructions on the http://allenbrowne.com/tips.html for limiting a report to a date range. At the bottom there is a note that says You will end up using this form for all sorts...
3
by: Tsair | last post by:
Select PoHead.*, PoItem.*, PoItem.Tranno as Tranno from PoItem INNER JOIN ON PoItem.Tranno = PoHead.Tranno Where PoHead.TranDate > #5/10/2005# AND PoHead.TranDate < #9/10/2005# AND TRUE ORDER BY...
3
by: Eddie901 | last post by:
I have a date field in a table formatted as a "Medium Date", e.g., 29-Mar-06. When I filter by that selection it's okay when the date is after the 13th of the month, but for the 12th or below it...
1
by: Cara Murphy | last post by:
Hi There! Hoping you are able to help me with a filtering scenario: I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which...
5
by: jambonjamasb | last post by:
I am wanting to create a report that summarises the number of items within a date range. For example I have a FIELD called System_Change. This is a drop down COMBOBOX that uses words like unix,...
8
by: mintz87 | last post by:
i have a table that has a beg_date & end_date (3/1/1985 & 3/1/1990) how do i, in access, break out this date range into another table by month. since this date range is a 60 month range it would...
1
by: ken | last post by:
I'm trying to implement Allen Browne's advice from http://allenbrowne.com/casu-08.html. Unfortunately, I'm getting this error: Run-time error '438': Object doesn't support this property or...
2
by: Lisa B | last post by:
I have managed to create a Report from a form that displays data per date In the query criteria for the date it references the form !! The report is based on the results of the query as per...
3
by: epifinygirl | last post by:
I currently have a report that summarizes my data for each client from the table (each page summarizes the information for each client). I have VBA code all set that can filter each client and print...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.