Query for leading blanks

G

Guest

certain Is there a query that will search for a number of leading blanks? I
have a text file (notepad) of music listings that has the band name (with 6
leading spaces) and the next line is the album name (with 9 leading spaces).
After that, there could be another album name or the next band name. I am
trying to put these into a table that will show these seperately so I can
avoid a LOT of typing.
Thanks!
 
R

Rick Brandt

Kim said:
certain Is there a query that will search for a number of leading
blanks? I have a text file (notepad) of music listings that has the
band name (with 6 leading spaces) and the next line is the album name
(with 9 leading spaces). After that, there could be another album
name or the next band name. I am trying to put these into a table
that will show these seperately so I can avoid a LOT of typing.
Thanks!

SELECT *
FROM TableName
WHERE FieldName LIKE " *"
 
G

Guest

That expression worked, but it isn't isolating only the name with a certain
amount of leading spaces. Any other ideas?
 
J

John Vinson

That expression worked, but it isn't isolating only the name with a certain
amount of leading spaces. Any other ideas?

Try

WHERE FieldName LIKE " *"
AND FieldName NOT LIKE " *"

to find records with six but not seven spaces.


John W. Vinson[MVP]
 
G

Guest

Thank you so much - that worked great!

Now - any idea on how I could query that if the first field is blank, then
go to the next?
 
J

John Vinson

Thank you so much - that worked great!

Now - any idea on how I could query that if the first field is blank, then
go to the next?

Now you'll have to explain that. "Go to the next"... field? Implies
incorrect table design. "next record"?

What's the structure of your table? Can you give some examples of the
data for which you're searching?

John W. Vinson[MVP]
 
G

Guest

I have imported a text file of album names along with the artist name. Bad
thing - it was imported to where the names are all in one field. I have
seperated them into two fields, but now some fields are blank. Now I'd like
for Access to search for the next "not null" field to give me the album name.
Example: "Band name" in Name.txt followed by a blank, next record the band
name will be blank and Name2.txt will contain the album name. Some bands have
more than one album, then there will be another band name followed by a blank
Name2, etc. Any ideas? I have two more lists to import and they won't import
the same way - they will have both names in the same field. Just trying to
find the easiest way to do this without a bunch of typing - there's about 3K
songs in the lists.

Thanks,
Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top