i have a query with 4 fields, and a form based on it. i put another 4 textbox to get criteria to filter the query. the query runs normally when all the textbox have a value (not null) but when one or more of them is empty (null) the query returns no records. how can i ignore the (null) in my criteria.
10 8336
Post the full query
i have a query with 4 fields, and a form based on it. i put another 4 textbox to get criteria to filter the query. the query runs normally when all the textbox have a value (not null) but when one or more of them is empty (null) the query returns no records. how can i ignore the (null) in my criteria.
Post the full query
how can i post the query?
Open the query in design view and then change the view button to show SQL. Then simply copy and paste the code here.
how can i post the query?
the query is:
SELECT Drugs.EnName, Drugs.Cmpny, Drugs.CPrice, Drugs.NPrice
FROM Drugs
WHERE (((Drugs.EnName)=[Forms]![SbQDrg]![TextA]) AND ((Drugs.Cmpny)=[Forms]![SbQDrg]![TextB]) AND ((Drugs.CPrice)=[Forms]![SbQDrg]![TextC]) AND ((Drugs.NPrice)=[Forms]![SbQDrg]![TextD]));
thanks a lot..
Try pasting this instead and see if it will work:
SELECT Drugs.EnName, Drugs.Cmpny, Drugs.CPrice, Drugs.NPrice
FROM Drugs
WHERE IIf(Not IsNull([Forms]![SbQDrg]![TextA]),[Drugs].[EnName]=[Forms]![SbQDrg]![TextA] AND)
IIf(Not IsNull([Forms]![SbQDrg]![TextB]),[Drugs].[Cmpny]=[Forms]![SbQDrg]![TextB] AND)
IIf(Not IsNull([Forms]![SbQDrg]![TextC]),[Drugs].[CPrice]=[Forms]![SbQDrg]![TextC] AND)
IIf(Not IsNull([Forms]![SbQDrg]![TextD]),[Drugs].[NPrice]=[Forms]![SbQDrg]![TextD]);
sorry..
but a syntax error in it because ofthe "( " can you send it again.
thanks..thanks..thanks
Are you still getting an error, if so what exactly does it say?
sorry..
but a syntax error in it because ofthe "( " can you send it again.
thanks..thanks..thanks
realy i don't try it again because i found a solution using VB-code that is:
If Not IsNull(Me.txtEnName) Then
strWhere = strWhere & "([EnName] = """ & Me.txtEnName & """) AND "
End If
and so on for other criteria then:
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
realy i don't try it again because i found a solution using VB-code that is:
If Not IsNull(Me.txtA) Then
strWhere = strWhere & "([EnName] = """ & Me.txtA & """) AND "
End If
and so on for other criteria then:
lngLen = Len(strWhere) - 5
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
thats all.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: robert |
last post by:
running 8.1.7 server, 8.1.6 client.
i *thought* inner join should not return nulls, but not only that,
but i get way more rows than i'm expecting.
assume:
order table:
order_number
|
by: Agoston Bejo |
last post by:
I want to enforce such a constraint on a column that would ensure that the
values be all unique, but this wouldn't apply to NULL values. (I.e. there
may be more than one NULL value in the column.)...
|
by: Gary |
last post by:
Hi! guys,
I have a SQL agent job fails because it gets 10 warnings when it runs
a stored procedure. These warnings are trivial and can be ignored. Can
I make it ignore these warnings and...
|
by: PC |
last post by:
Hi,
I have used the DLast("!","")function
to find and display the last entry in a table. How would I go about
displaying the last record in a table that is not Null?
Thanks in advance
...pc
|
by: AAVF |
last post by:
Hi
We have a problem with a query.
An Access database links via ODBC to a UNIX server. To speed things, we use
the ODBC to load the relevant tables to the local PC that runs Access so
that...
|
by: google |
last post by:
This is something I've done plenty of times in '97, but I can't seem to
get it to work correctly in Access 2003. Say, for example, I have a
form with an unbound combobox, the data source is a...
|
by: Simon |
last post by:
Dear reader,
I found out a strange behaviour in a query of the type Total (summation
query).
In case of a normal select query with a criteria setting Is Null for
field-A, four (4) records...
|
by: nickvans |
last post by:
I have a form in which users may search for a module based on a number of criteria including three check boxes (indicating which processes have been completed) as well as a text box for the user to...
|
by: prabirchoudhury |
last post by:
CRITERIA;
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
| |