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

Date and Is Null Text Parameters Help

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 3434
MSeda
159 Expert 100+
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,556 Expert Mod 16PB
Try :
Expand|Select|Wrap|Line Numbers
  1. Like Nz([Enter Accountant],'') & '*'
Jun 11 '07 #3
hyperpau
184 Expert 100+
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,556 Expert Mod 16PB
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
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
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...
7
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)...
5
by: tshad | last post by:
I have the following code: *************************************************************************** Dim CommandText as String = "INSERT INTO ftsolutions.dbo.position (client,dateposted) VALUES...
1
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...
5
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...
8
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() ...
2
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...
0
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 :...
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...
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
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...
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
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,...
0
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...
0
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...

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.