473,614 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Like Nz() in Access losing records when used more then once in query

I have a query with 5 possible criteria via a form. If criteria is
not entered, I use the like Nz() function on the backend query to use
an "*" for criteria fields left blank. The query is not returning the
full recordset. If the Like Nz() function is used on 1 field, it
returns the correct number of records. As soon as I add it on more
then one field, it loses records somehow. ???

For example,
SELECT [Glossary].GlossaryID, [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE ((([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*"));

This returns the correct number of fields using the function on one
field.

This below does not:
SELECT [Glossary].GlossaryTermID , [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE (([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*")) And (([Glossary].Status) Like
Nz(Forms!JenSel ection!Status," *")) And
(([Glossary].MaintenanceCat egory) Like
Nz(Forms!JenSel ection!Maintena nceCategory"*") );
Nov 12 '05 #1
2 2585
Jennifer wrote:
I have a query with 5 possible criteria via a form. If criteria is
not entered, I use the like Nz() function on the backend query to use
an "*" for criteria fields left blank. The query is not returning the
full recordset. If the Like Nz() function is used on 1 field, it
returns the correct number of records. As soon as I add it on more
then one field, it loses records somehow. ???

For example,
SELECT [Glossary].GlossaryID, [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE ((([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*"));

This returns the correct number of fields using the function on one
field.

This below does not:
SELECT [Glossary].GlossaryTermID , [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE (([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*")) And (([Glossary].Status) Like
Nz(Forms!JenSel ection!Status," *")) And
(([Glossary].MaintenanceCat egory) Like
Nz(Forms!JenSel ection!Maintena nceCategory"*") );


So you are looking for all records where the coordinator name is null
and a status that is null and a maintenace category that is null. I
would expect your query is returning all records where those conditions
are true. Isn't that what you asked for?
Nov 12 '05 #2
Try the setting up your query using OR rather than AND
"Jennifer" <je************ ***@fmglobal.co m> wrote in message
news:e3******** *************** ***@posting.goo gle.com...
I have a query with 5 possible criteria via a form. If criteria is
not entered, I use the like Nz() function on the backend query to use
an "*" for criteria fields left blank. The query is not returning the
full recordset. If the Like Nz() function is used on 1 field, it
returns the correct number of records. As soon as I add it on more
then one field, it loses records somehow. ???

For example,
SELECT [Glossary].GlossaryID, [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE ((([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*"));

This returns the correct number of fields using the function on one
field.

This below does not:
SELECT [Glossary].GlossaryTermID , [Glossary].CoordinatorNam e,
[Glossary].Status, [Glossary].MaintenanceCat egory
FROM [Glossary]
WHERE (([Glossary].CoordinatorNam e) Like
Nz(Forms!JenSel ection!Coordina tor,"*")) And (([Glossary].Status) Like
Nz(Forms!JenSel ection!Status," *")) And
(([Glossary].MaintenanceCat egory) Like
Nz(Forms!JenSel ection!Maintena nceCategory"*") );

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4742
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record onto the bottom of the list (even though it keeps its record number). Also, There are certin names that i click on the list, and it will not bring it up, rather it brings to the first record (no matter how many times i try going to that...
4
2487
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field to record the record's status. Sample data: *tblTest* Model Parts CDate CStatus RDate RStatus 616 $359.79 03-Nov-03 C
2
2168
by: Jennifer | last post by:
I have a query with 5 possible criteria via a form. If criteria is not entered, I use the like Nz() function on the backend query to use an "*" for criteria fields left blank. The query is not returning the full recordset. If the Like Nz() function is used on 1 field, it returns the correct number of records. As soon as I add it on more then one field, it loses records somehow. ??? For example, SELECT .GlossaryID,...
19
4086
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
3
17046
by: carrionk | last post by:
Hi, I'm running an ADO Recorset from Excel to gather data from Access. Basically it's copying the records of a query -that runs without problem in Access- That query has an expression with NZ() function. Used to sum two separate fields because I found that if there is a null field an addition operation is not performed. When running the ADO Recorset, I get the following message:
42
2201
by: lylefair | last post by:
The file is now available as http://www.ffdba.com/downloads/testingNZ3.dat (rename .dat to .mdb) or http://www.ffdba.com/downloads/testingNZ3.mdb (At time of posting I have not opened the file.)
10
4574
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression)" **** How many records are there in FirstTable in which Product Is Null. SELECT COUNT(*) AS CountofNullProdcut
2
2373
by: roz | last post by:
Hello, I'm fairly new to VB programming and I've been going round the bend with this problem, so any nudges or shoves in the right direction would be greatly appreciated. I have a template form in Word. The information that I need to populate this form is from 2 tables in an Access 2002 database (patient details and GP details). Once the user has entered the patient and GP etc details, they need to produce a case summary (including...
2
2744
by: Will | last post by:
Hi, I need to handle blank values in a query calculation. I have 636 records at the moment but when I sum over these records the blank fields are not returned. I have looked around here and on Access help and the Nz function seems to be the way forward. I am summing over 6 fields, all or none of which may contain values. The expression syntax I have used is as follows:
0
8640
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
8589
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...
0
8443
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7114
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
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
5548
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();...
0
4058
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2573
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
1
1757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.