Working with Null Values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a query to pull up all my account service records via a form and
subform - Main form is from account table, subform is the query of service
records relating to that account.

Sometimes there too many service records to view easily, I have then created
a text/list box on the main form which I can enter some data in to cut down
the return entries on the subform from the query.

for instance

Like [Forms]![Equipsearch]![Combo2] - combo 2 contains data like "Ford" so I
only see the Ford entries.

But by entering this code my it is forcing me to enter data into combo 2 to
get a result, which when I have smaller account this then causes problems.

I need (but have no idea how to write it) the following

If combo2 empty ignore if not do this - Like [Forms]![Equipsearch]![Combo2]

Any help greatly appreciated
 
Better use

Where FieldName Like [Forms]![Equipsearch]![Combo2] Or
[Forms]![Equipsearch]![Combo2] Is Null


Using Like [Forms]![Equipsearch]![Combo2] & "*"

Will return "Ford Something" , even though only "Ford" was selected


--
Good Luck
BS"D


KARL DEWEY said:
Like [Forms]![Equipsearch]![Combo2] & "*"

--
KARL DEWEY
Build a little - Test a little


CP said:
I am using a query to pull up all my account service records via a form and
subform - Main form is from account table, subform is the query of service
records relating to that account.

Sometimes there too many service records to view easily, I have then created
a text/list box on the main form which I can enter some data in to cut down
the return entries on the subform from the query.

for instance

Like [Forms]![Equipsearch]![Combo2] - combo 2 contains data like "Ford" so I
only see the Ford entries.

But by entering this code my it is forcing me to enter data into combo 2 to
get a result, which when I have smaller account this then causes problems.

I need (but have no idea how to write it) the following

If combo2 empty ignore if not do this - Like [Forms]![Equipsearch]![Combo2]

Any help greatly appreciated
 
Or use the NZ Function
Like Nz([Forms]![Equipsearch]![Combo2],"*")

Although that assumes that whatever field you are applying the criteria
always has a value.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Ofer Cohen said:
Better use

Where FieldName Like [Forms]![Equipsearch]![Combo2] Or
[Forms]![Equipsearch]![Combo2] Is Null


Using Like [Forms]![Equipsearch]![Combo2] & "*"

Will return "Ford Something" , even though only "Ford" was selected


--
Good Luck
BS"D


KARL DEWEY said:
Like [Forms]![Equipsearch]![Combo2] & "*"

--
KARL DEWEY
Build a little - Test a little


CP said:
I am using a query to pull up all my account service records via a
form and
subform - Main form is from account table, subform is the query of
service
records relating to that account.

Sometimes there too many service records to view easily, I have then
created
a text/list box on the main form which I can enter some data in to cut
down
the return entries on the subform from the query.

for instance

Like [Forms]![Equipsearch]![Combo2] - combo 2 contains data like "Ford"
so I
only see the Ford entries.

But by entering this code my it is forcing me to enter data into combo
2 to
get a result, which when I have smaller account this then causes
problems.

I need (but have no idea how to write it) the following

If combo2 empty ignore if not do this - Like
[Forms]![Equipsearch]![Combo2]

Any help greatly appreciated
 
Back
Top