Doug,
I don't think it's the code...the space dissapears when I tab out of the
field. When I tab back in, the space is gone...so before the code ever
runs,
there is no space in the string. It's as if Access is removing the space
automatically. You can test this on a blank db...make two unbound fields
on
a form, both text. Enter 'ab ' in the first one and tab to the 2nd one,
the
space will dissapear.
Since the 2nd option would return the same problem I have now, I tried the
first (just to see if it made a difference), and the code doesn't work -
generates a type mismatch error.
The code starts like this:
If Not IsNull(Me.srchLegalName) Then
strWhere = strWhere & "([LenderLegalName] Like ""*" &
Me.srchLegalName & "*"") AND "
End If
When I try to modify it like you suggested, it changes to this:
If Not IsNull(Me.srchLegalName) Then
strWhere = strWhere & "([LenderLegalName] Like " * " &
Me.srchLegalName & " * ") AND "
End If
But like I said...if the space is stripped before I can even run the code,
it's probably not a problem with the code but how Access is treating the
field.
Douglas J. Steele said:
Presumably your query has something like the following in its criteria:
Like "*" & Forms!FormName!ControlName & "*"
Either type "US B" into the text box, or change the criteria to
Like Forms!FormName!ControlName & "*"
(although you'd still get USELESS PLACE TO SAVE MONEY returned with the
second one)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I have a search form where I have multiple fields I can enter search
criteria
in. I want to be able to search by the exact entry I put in the field.
For example, if I have text that contains 'US BANK', 'WILD ICHYBODS
BANK
AND
TRUST', and I search for 'US' I'll get both results. I want to be able
to
enter 'US ' (US and a space) and only get 'US BANK' as a return.
When I enter the trailing space, as soon as I tab out of the field, it
is
removed.
How can I turn that off?
Thanks!