473,466 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Ignoring criteria in a query if the field is Null

27 New Member
Hello,

I've developed my first Form, a simple affair that enables the user to search text in the memo fields in our database. When the "search" button is pressed, it runs a macro which runs the simple query.

I have added a second field to the form, in addition to the text search field. This new field allows the user to type in an identification number, which returns all of the memo fields associated with that particular client. If the user enters an ID number in the ID field of the form as well as a search term in the text search field of the form, it returns all memo fields of that particular client which contain that particular search term.

So far so good. But, the problem:

Now that I've added the ID field, if the user enters ONLY a memo search term and gives no value to the ID field, they get no results because the query is looking for ID field = Null and none of our ID fields are Null.

Is there a way to set this up so that the query is aware that just because a value is not entered into the ID field, the user still wants to see the results of the memo text search (which would apply to all ID numbers)?

Thank you so much for your advice!

- John

MS Access Version: 10.6501.6626

id_number field criteria: [Forms]![QBF_Form]![id_number]

and

memo field criteria: Like ("*" & [Forms]![QBF_Form]![summary] & "*")
Jul 3 '07 #1
3 7238
nico5038
3,080 Recognized Expert Specialist
Just use for the ID also a LIKE * [ID] *, thus when there's no ID it will search for LIKE ** and select all.

Personally I never code this. I instruct my users to use the right-click pop-up form and they can thus perform every filtering they need on all fields, even a LIKE with a joker (*) as that can be entered in the third option's textbox.

Nic;o)
Jul 3 '07 #2
seagullino
27 New Member
Thank you Nico, that tip helped me fix the problem!

What is the right-click pop-up form that you refer to?

Thanks,

John
Jul 5 '07 #3
nico5038
3,080 Recognized Expert Specialist
Check out my description I give my users:
http://www.geocities.com/nico5038/xR...nstruction.zip

Took me a while to discover the possibilities, but I use it all the time to filter tables and/or forms.

Nic;o)
Jul 5 '07 #4

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

Similar topics

7
by: Jack | last post by:
Hi, I have posted this problem before. Apprently, the suggestion took care of the problem. However, still I am getting the above error message. I am using a session variable to transfer a value...
3
by: Laurel | last post by:
this is driving me crazy. i need to use a form control as a criteria in a select query, and the control's value is set depending upon what a user selects in an option group on the form. the query...
2
by: neptune | last post by:
I have a query where each customer has an or . Sometimes both fields for a customer are populated, but if is null, then will be populated and vice versa. I have a form, , where I select a...
8
by: Vince Morgan | last post by:
Hi, I'm not sure that I have the right group, so please bear with me. Recently I created a fuction in the MS Access VBA IDE. The function returns a Boolean. I created the function to use as...
7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
4
by: TD | last post by:
I have a form that has a frame control named fraComplaint. I have a query that I need to return records that have an empty Date_Closed field when the value of fraComplaint is 2 and all records...
2
by: tricard | last post by:
Good day all, I have a large outer joined query that I want to have some criteria. The select query is gathering all part numbers from tblPartNumbers, left joining to tblPartNumberVendor (since...
2
by: Mark Roughton | last post by:
I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related data for the selected date, for all dates upto and...
10
by: aaronrm | last post by:
I have a real simple cross-tab query that I am trying to sum on as the action but I am getting the "data type mismatch criteria expression" error. About three queries up the food chain from this...
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
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:
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.