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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Criteria in query not returning existing string

Status
Not open for further replies.

ddelk

Programmer
May 28, 2003
47
0
0
US
I have a string field that is 50 char in length. My data is about 10 char but it can vary so I left the default as 50. When I do a query and search for a specific string, the query does not return a string I know exists in the table. When I do (Like "*<string>") it finds the string. Is Access hiding some leading string values I can't see?

The string values are generated by concatenating a number (converted with the str function) and another string. Is Access keeping leading zeroes from the number?

Thanks
 
Upon further review, when I export the data to txt files, I get a leading space. So I get " 12345" instead of "12345". Any idea why this happens or how to remove it?
 
Found it. I simply have to surround the conversion with the Trim function. So

Trim(Str(<number>))

This does both leading and trailing spaces. LTrim does leading only and RTrim does trailing only.
 
Hallo,

If you looked in the help for Str, you would see that it includes a space for +ve numbers.
It would not add leading zeroes though.

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top