473,569 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ 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 7258
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
2606
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 from a form to a confirmation.asp page. This value is a calculated field. For most cases this session variable value should be zero. However, instead,...
3
3965
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 results should return information on either a single employee or all employees. the problem that i have is that if i type in "*" (but without...
2
2910
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 value for from a combo box. In my query I set the criteria for to ... My query finds the proper values for . Now I also want to find the values...
8
1922
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 criteria in an Access query, and then I discovered a problem. The query runs ok, but it's apparently ignoring the functions return val. It doesn't...
7
3772
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 on a query. The criteria for the query is based on the user's input in the main form. One of the user inputs is a field called "Vendor_Name" (in the...
4
6589
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 when the value of fraComplaint is 1(the only two values possible for fraComplaint are 1 and 2). In the criteria section on the query I put this...
2
3135
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 more than one vendor can make the part), then left joining to tblPartNumberSupplier (since more than one supplier can distribute the vendor's part),...
2
5726
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 icluding the selected date or all records on or after the selected date The user selects either "=", >=" or "<=" from a combo box and then a date...
10
6212
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 cross-tab query I am using a simple query with no grouping where I am filtering some data out in the criteria line. I have been out of access for...
0
7612
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...
0
8119
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...
1
7668
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...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5218
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...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
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...

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.