473,396 Members | 1,996 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.

subform filtere between two dates (TextBoxes) and other comboboxes

Dear all
am trying to filter a subform by using multiple comboboxes (which is workin gperfectly) but when i needed to add two additional filters (Date_From) and (Date_To) the system is giving me a syntax error the code is as follows ::

Expand|Select|Wrap|Line Numbers
  1. strFilter = "[Client_first_name] Like '" & Me![Text39] & "*'  AND [Client_Nature] Like '" & Me![Combo58] & "*'  AND [BO_Advisor_Name] Like '" & Me![Text35] & "*' AND [Service_Group] Like '" & Me![Text54] & "*' AND [Atom_Name] Like '" & Me![Combo56] & "*' AND [Client_Last_Name] Like '" & Me![Text41] & "*' AND [Service_Details] Like '" & Me![Text31] & "*' AND [Client_Id] Like '" & Me![Text37] & "*' AND [HO_Name] Like '" & Me![Text33] & "*' AND [date_today] between # " & Format([Forms]![Generation_Report]![Text25], "DD/MM/YYYY") & " # AND # " & Format([Forms]![Generation_Report]![Text49], "DD/MM/YYYY") & " # "
  2. Me.Data_Capturing_Sheet_subform.Form.Filter = strFilter
  3. Me.Data_Capturing_Sheet_subform.Form.FilterOn = True
---------------

the error is somewhere after AND [HO_Name] please am desperate
Dec 10 '11 #1
3 2484
Stewart Ross
2,545 Expert Mod 2GB
I have rewritten your statement in a clearer multi-line format below. I am not seeing any syntax errors. Try the multi-line version below and see which line causes the error.

Expand|Select|Wrap|Line Numbers
  1. strFilter = _
  2.    "[Client_first_name] Like '" & Me![Text39] & _
  3.    "*' AND [Client_Nature] Like '" & Me![Combo58] & _
  4.    "*' AND [BO_Advisor_Name] Like '" & Me![Text35] & _
  5.    "*' AND [Service_Group] Like '" & Me![Text54] & _
  6.    "*' AND [Atom_Name] Like '" & Me![Combo56] & _
  7.    "*' AND [Client_Last_Name] Like '" & Me![Text41] & _
  8.    "*' AND [Service_Details] Like '" & Me![Text31] & _
  9.    "*' AND [Client_Id] Like '" & Me![Text37] & _
  10.    "*' AND [HO_Name] Like '" & Me![Text33] & _
  11.    "*' AND [date_today] between # " & _
  12.    Format([Forms]![Generation_Report]![Text25], "DD/MM/YYYY") & _
  13.    " # AND # " & _
  14.    Format([Forms]![Generation_Report]![Text49], "DD/MM/YYYY") & _
  15.    " # "
  16. Me.Data_Capturing_Sheet_subform.Form.Filter = strFilter
  17. Me.Data_Capturing_Sheet_subform.Form.FilterOn = True
  18.  
-Stewart
Dec 10 '11 #2
TheSmileyCoder
2,322 Expert Mod 2GB
I suggest you try looking at these two threads and see if any of it applies to your case.
literal datetimes and their delimiters
Discussion:SQL date literals - regional settings

I also most strongly urge you to always name your textboxes. It may seem trivial now, but it will save you alot of trouble down the road.
Dec 10 '11 #3
NeoPa
32,556 Expert Mod 16PB
It never ceases to surprise me that memebers who claim to be desperate, still waste so much time and energy by posting poor quality, incomplete questions.

Actually, the advice already given is about all you could wish for. If you follow it all you will have made great strides and learned much. The one thing I would add is to include parentheses as a general rule to separate the different tests in your filter. Otherwise what is already here should help you resolve all the problems I see with your code and how you work with it.
Dec 11 '11 #4

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

Similar topics

1
by: jbroome | last post by:
I have a main form which contains information for several subforms which I can link no problem but i also have some other information from another table which i wish to attach to the main form for...
7
by: ChrisR | last post by:
Hi guys My app is a simple Main form with a few Subforms that are not linked, and a few pop forms. Problem is: I have a pop form with a Listbox with a list of records related to the...
2
by: Simon Pleasants | last post by:
I recently built a database to help keep track of shipments we are bringing into the country. Included in the database are a number of fields with dates for shipment, ETA etc. Each one of these...
2
by: Reidar | last post by:
I am making a datagrid with one table. In this datagrid I change som columns from textboxes to comboboxes. The comboboxes has datasource from another table, displaymember is the textfield from...
5
by: DW | last post by:
I have a query in Access 2003 that has the following criteria SELECT tblOrder.SessionDate, tblMenus.Item_Name, tblOrder.Type, Format$(tblorder!SessionDate,"Short Time") AS SessionTime,...
1
by: David | last post by:
Using Access 2002. I have a form with several subforms. Subform2 allows the user to insert a record into a table. One of the fields in this table is an account number, which is displayed in...
3
AccessIdiot
by: AccessIdiot | last post by:
I was successful with help from another thread (this one ) in enabling and disabling a form/subform with a button. Essentially you press a button on the form and the form controls are disabled but...
4
by: OzNet | last post by:
I have a form with a subform and I need to filter the records in the subform by dates. (Access 2007) The main form has two unbound text boxes called StartFilter and EndFilter. Both use the...
0
by: Gordon Padwick | last post by:
A form contains controls, one or more of which can be other forms. A form that contains another form is known as a main form. A form contained by a main form is known as a subform. A subform itself...
1
by: Umesh Bane | last post by:
I have made the form with unbound textboxes and comboboxes. after filling the data in the text boxes by user, with the command button called 'add records' the records are transfer to the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.