Solved

if column in table has no values - search does not work

Posted on 2014-03-15
4
292 Views
Last Modified: 2014-03-15
am attaching sample database- 3 fields in table
id field/ N1 /N2
if there is not a number in the N1 or N2 fields ( or a zero) search does not work- so when import numbers in - there are no zeros
Is there anyway to make this work without adding zero's

open database - open search form- enter 1017 - number should display - but enter 133 and nothing
thank you
Database-Search.accdb
0
Comment
Question by:davetough
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 400 total points
ID: 39931431
change

=N1 + N2

to

=Nz([N1])+Nz([N2])
0
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 100 total points
ID: 39931579
I like to be explicit with functions like this.  Nz() operates differently with different data types so to avoid unexpected results, always specify what you want the expression to return.

=Nz([N1],0)+Nz([N2],0)

You will need to use the Nz() function whenever you are doing calculations that include a column that might be null.  However, domain functions will ignore nulls and so don't have a problem.
=Sum(yourfield)
=Avg(yourfield) --- The Avg function counts the non-null values to get the divisor so

2, 0, 4 returns 2
but
2, null, 4 returns 3
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39931660
in using the Nz(variant, valueifnull) function, the "valueifnull" is optional unless you use the nz() function in a query.

in this case, specifying the optional value is redundant.
if the [variant] is null, nz will return a value of zero or zero length string, depending on the data type of [variant], Number or Text

?null + 2  will give you null
?nz(null) + 2  will give you 2

see this link for more info
http://office.microsoft.com/en-us/access-help/nz-function-HA001228890.aspx
0
 

Author Closing Comment

by:davetough
ID: 39932032
thank you for help and explanation
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now