473,396 Members | 1,847 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,396 software developers and data experts.

filter question

266 256MB
i have a form where i can filter results using the following code

Expand|Select|Wrap|Line Numbers
  1. 'CheckFilter produces the new Filter depending on the values currently in
  2. 'txtFindAccountCode, txtFindCreationDate & cboFindAccountType.
  3. Private Sub CheckFilter()
  4.     Dim strFilter As String, strOldFilter As String
  5.  
  6.  strOldFilter = Me.Filter
  7.     'txtFindCreationDate - Date
  8.     If Me!yearsearch > "" Then _
  9.         strFilter = strFilter & _
  10.                      " AND ([Date1]Like '" & _
  11.                     Me!yearsearch & "*')"
  12.  
  13.    'Tidy up results and apply IF NECESSARY
  14.     If strFilter > "" Then strFilter = Mid(strFilter, 6)
  15.     If strFilter <> strOldFilter Then
  16.         Me.Filter = strFilter
  17.         Me.FilterOn = (strFilter > "")
  18.  
  19.     End If
  20. End Sub
then i have a button coded with "call checkfilter" to filter the results.

i am only looking to filter results by year but my date field is formatted like this "1/1/2010" is there any way i can search for just a four digit year? currently i am doing */*/2010 to find results for 2010...i would prefer to just type 2010... thanks!
Apr 23 '10 #1
1 1202
MikeTheBike
639 Expert 512MB
@didacticone
Hi

Try changing the filter criteris to this

strFilter = strFilter & " AND (Year([Date1]) = " & Me!yearsearch & ")"

where Me!yearsearch is an integer year.

HTH


MTB
Apr 23 '10 #2

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

Similar topics

9
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after...
1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
8
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
4
by: Keith | last post by:
A2003, XP Pro. I'm in the middle of designing a form to act as a custom filter, like a very basic 'filter by form'. It has two sets of combos, those on the left are to choose the field name(s)...
2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
2
by: AAJ | last post by:
I know this sounds nuts, but how do I remove the following filter from a Object Datasource that looks at my business layer... ODSDefaultUserProfiles.FilterExpression = "AllowedWebPage = '" +...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
15
by: scatterbrain | last post by:
I'm trying to create a popup form so that my peers have and easy way to filter information by 4 categories: Presenter, Evaluator, Date, or Topic. All this information is stored in my Data table and I...
3
by: Soulspike | last post by:
Form name to filter = frmSortFor Filter based on list box from frmTest= lstSortFor Form containing list box = frmTest Field (CompCodes) data format = "PM SM TS EW WA" I have a database that I...
4
by: Twayne | last post by:
Hi, I've been playing with ' if(!filter_var($email, FILTER_VALIDATE_EMAIL)) ' on my server and it seems to be working 100%. Pretty handy. Any ideas where I could find a summary of the e-mail...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.