Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not IN not able to take null values

Status
Not open for further replies.

Triacona

Technical User
Jun 11, 2009
462
0
0
GB
Dear All,

Great forum! [smile]

I have a the following senario.

Query - EnAllocationOverdue

Form - MainScreen

Within the query the field ENSTAT.UNI7LIVE_ENCASE is the one I wish to filter using the form.

In the form the fields AddSrch and SrchCrit are the fields the user fills in and this then should exclude the data from the query.

I have tried serveral variations on the field within the query.
It seems to work only when there are values within the form fields.

Here are some of the examples I have tried in the ENSTAT.UNI7LIVE_ENCASE query field.

1
Code:
Not In ([Forms]![MainScreen].[AddSrch],[Forms]![MainScreen].[SrchCrit])
2
Code:
Not In (Nz([Forms]![MainScreen].[AddSrch],[Forms]![MainScreen].[SrchCrit]))
3
Code:
Nz(Not In([Forms]![MainScreen].[AddSrch],[Forms]![MainScreen].[SrchCrit]))
4
Code:
Not In (Nz([Forms]![MainScreen].[AddSrch]),Nz([Forms]![MainScreen].[SrchCrit]))

None of the above give results when the fields are blank, only when they are filled in does it give results, i.e. the exclusion of the values within the form fields.

Any help would be greatly appreciated[smile]

Thank you[bigsmile]


Thank you,

Kind regards

Triacona
 
Dear All,

I have figured it out! [bigsmile]

The solution is:
Code:
Not In (Nz([Forms]![MainScreen].[AddSrch],"ZZZZZ"),Nz([Forms]![MainScreen].[SrchCrit],"ZZZZZ"))

Thanks [smile]

Thank you,

Kind regards

Triacona
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top