Display a query using a form

Display a query using a form

Post by Qm9iIE » Fri, 20 Jan 2006 06:41:03


I have a form that when a street name is entered it displays the result of a
query that search's a address field for a street name. In the address field I
have this string: Like ("*" & ([Forms]![StreetLookup]![text10]) & "*"). This
does work but when I display the form for the first time it displays a whole
list of addresses instead of being blank.
The forms default view is continuious. I have used this tecnique before for
other lookups and the initial form always came up blank.
 
 
 

Display a query using a form

Post by Wayne Morg » Fri, 20 Jan 2006 11:14:40

Using the criteria you list, if Text10 is blank, then the criteria is

Like("**")

This will return all records. Instead try:

Like (IIf(IsNull([Forms]![StreetLookup]![Text10]), Null, "*" &
([Forms]![StreetLookup]![text10]) & "*"))

If you have Null values in this field, then those records will still be
returned. If so, replacing Null with "" may do what you need.

--
Wayne Morgan
MS Access MVP

 
 
 

Display a query using a form

Post by Qm9iIE » Sat, 21 Jan 2006 03:06:02

That did the trick. Thank You