List box showing specific queries

G

Guest

I am trying to create a list box that shows a specific set of queries for
users to select from (click on) and print or view or whatnot. Now, I have a
handy-dandy Access textbook that gives me the following SQL statement to use
(let the forehead slapping and eye-rolling begin, you've all likely seen this
lovely example):

SELECT [Name] FROM MSysObjects WHERE [Type]=5 And Left([Name],1)<>"~" ORDER
BY [Name];

Okay, that works great if I wanted to see ALL available queries, but I just
want a select few. The queries I want all happen to begin with a similar
naming covention so I thought this would an easy thing to figure out. But
I'm at a loss. My SQL experience is still very limited. I even searched
here, but became bug-eyed and dizzy with all the posts. So I apologize if the
answer I seek is already in an existing post and I missed it.

Basically, I want to see all queries that have names beginning with
"qtrack***" (that's part of our naming covention here). How would I write
the SQL statement to just pick up only those specific queries?

Any help would be greatly appreciated.
 
D

Douglas J. Steele

SELECT [Name] FROM MSysObjects WHERE [Type]=5 And [Name] LIKE "qtrack*"
ORDER BY [Name]

If you want qtrack followed by exactly 3 characters, try

SELECT [Name] FROM MSysObjects WHERE [Type]=5 And [Name] LIKE "qtrack???"
ORDER BY [Name]

-
Doug Steele, Microsoft Access MVP

(no private e-mails, please)
 

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