473,770 Members | 4,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date and Is Null Text Parameters Help

1 New Member
Hello,
I've created a select query with a date range parameter as well as a text field parameter

Between [Start Date] and [End Date]

The second parameter:

Like [Enter Accountant] or Like [Enter Accountant] Is Null.

When you run the query, and enter the range and the Accountant's name, it returns the accountants records for the specified date range. When you enter the date range and leave the accountant parameter blank, it returns all records regardless of the date range entered. How do I set this up to deliver all accountants records within the date range if the parameter is blank? Any help would be greatly appreciated!
David
Jun 11 '07 #1
4 3452
MSeda
159 Recognized Expert New Member
I can't say for sure with out seeing the sql but I think you have made a common error entering the criteria. In the access query design view on the first criteria row enter the Between [Start Date] and [End Date]
and under the accountant enter Like [Enter Accountant]
move to the next criteria row and again enter the Between [Start Date] and [End Date] and enter the like [Enter Accountant] is Null in the accountant column.
If you look at the SQL it should look some thing like:

Expand|Select|Wrap|Line Numbers
  1. Select [AuditTable].* FROM [AuditTable] WHERE (AuditDate between [Start Date] and [End Date] AND Accountant like [Enter Accountant]) OR (AuditDate between [Start Date] and [End Date] AND Accountant like [Enter Accountant] is Null)
Jun 11 '07 #2
NeoPa
32,573 Recognized Expert Moderator MVP
Try :
Expand|Select|Wrap|Line Numbers
  1. Like Nz([Enter Accountant],'') & '*'
Jun 11 '07 #3
hyperpau
184 Recognized Expert New Member
Hello,
I've created a select query with a date range parameter as well as a text field parameter

Between [Start Date] and [End Date]

The second parameter:

Like [Enter Accountant] or Like [Enter Accountant] Is Null.

When you run the query, and enter the range and the Accountant's name, it returns the accountants records for the specified date range. When you enter the date range and leave the accountant parameter blank, it returns all records regardless of the date range entered. How do I set this up to deliver all accountants records within the date range if the parameter is blank? Any help would be greatly appreciated!
David

You don't need complexities for this.

Remove the LIKE in the criteria. Just type in [Enter Accountant] OR Is Null

I tried this myself and I guarrantee you it will work but make sure that when user
inputs the accountant name, it should be the exact spelling or name.

Remember, if you use the LIKE parameter, you need a wild card (*).

ex: Like "st*" which would show results for all those records starting with the letters s and t. which is why it is impossible to use the LIKE parameter coz you would be stucked with fixed starting charactes.
Jun 13 '07 #4
NeoPa
32,573 Recognized Expert Moderator MVP
I think perhaps you misunderstand something of what was posted before (and possibly of what's requested).
The solution I provided actually handled all the issues you brought up, and was also less complicated. Let me know if you would like a breakdown of how (or why) it works.
Jun 13 '07 #5

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

Similar topics

4
6182
by: Leonardo Almeida | last post by:
Hi, I have a table with the follow fields : ID - Int Date - Datetime I need to make a simple query to result the records between to dates with a single ID.
1
5149
by: Michael Albanese | last post by:
I am building an application to report on-the-job injuries and incidents. There are a lot of Date fields, some of which are optional and can be left blank by the user. I have allowed Nulls on these fields in my SQL Server DB, as well as in my stored proc. The problem is that when I submit this data i get an error that states "Input not in date format" or a similar statement when there arevnull date fields.
7
2461
by: Arek | last post by:
Hey, I am inserting values in the table: Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks (idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text & "')", conn) sqlcomm1.ExecuteNonQuery() Query is working fine if there is value in the txtOutDate, but if user leaves the field txtOutdate empty, system insert date 1900-01-01. I want
5
2154
by: tshad | last post by:
I have the following code: *************************************************************************** Dim CommandText as String = "INSERT INTO ftsolutions.dbo.position (client,dateposted) VALUES ( @client,@dateposted)" Dim objCmd as New SqlCommand(CommandText,objConn) with objCmd.Parameters .Add("@client",SqlDbType.Char,50).value = "the companies next test" .Add("@dateposted",SqlDbType.datetime).value = dateposted.text
1
1116
by: Sunil Sabir | last post by:
Dear All, I have a field in the datebase called ReacheIELTSDate with a DataType "datetime" with a length 8. I have a ASPX Web Form with several TEXTBOXES to insert values into the database table. One of the textbox is attached to this date field . I have a save button which saves the values in the datebase when the user enters something in the txtdate text box. Thats fine I have no problem with that. But when the txtdate box is left...
5
3051
by: Øyvind Isaksen | last post by:
I have a page with an optional integer-field, and one asp:calendar control. I use a stored procedure to save the data in SQL Server. When all fields contains data, the code works great! But if the user dont fill in the optional "price-field" (integer value), or if the user dont choose a date in the asp:calendar control, I get the message "Input string was not in a correct format". How do I save "Null" value if the price-field is blank,...
8
1690
by: dhoward | last post by:
I keep getting this error and I can't seem to correct it. System.InvalidCastException: Cast from string "" to type 'Date' is not valid. Here's the code. Sub InsertTempTables() 'Sub proc that inserts info into temp tables
2
2432
by: preeti13 | last post by:
Hi guys i am here with my another probelm please help me.trying insert the value into the data base but getting the null value error .I am getting thsi error Cannot insert the value NULL into column 'EmployeeID', table 'Accomplishments.dbo.Accomplishment'; column does not allow nulls. INSERT fails. The statement has been terminated. and my code is this using System; using System.Collections;
0
3688
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example : parameter 1 - From Collection Date parameter 2 - To Collection Date I should display the results base on this selection criteria : 1) specific date - to enter specific date in FROM and TO field eg 20071227 to 20071227 2) greater or equal date -...
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.