I have a client who likes to create their own queries. They use these queries as a basis for a variety of mailings they send out to their clients. I have created a routine that will take the email address from a query, combine it with a selected PDF file and perform a blitz emailing by passing the information to Outlook. Right now, it works for one query. They would like to create a number of queries, on-the-fly, and have the ability to select the query from a combo box. Is there some easier solution or is there any way of listing all queries in a combo box and allowing them to select one? I’m thinking there must be a way of populating a table with the query names and then referencing this table in the combo box. How would I do that?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
List available queries in combo box? (Access 2007)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » List available queries in combo box? (Access 2007)
- This topic has 6 replies, 3 voices, and was last updated 16 years, 8 months ago.
Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerOctober 23, 2008 at 1:44 am #1130042The following works in all previous versions of Access; I hope it works in Access 2007 too, but I can’t test that.
– Set the Row Source Type property of the combo box to Table/Query.
– Set the Row Source property to the following SQL string:SELECT [Name] FROM MSysObjects WHERE [Type]=5 AND [Flags]=0 ORDER BY [Name]
-
WSodeus
AskWoody LoungerOctober 23, 2008 at 2:38 am #1130046It’s almost perfect, Hans (I’ve learned to expect nothing less from you!)
I found a query in the list that started with a tilde (~). I presume this is some kind of system file? I excluded it by modifying your statement to the following:
SELECT [Name] FROM MSysObjects WHERE [Type]=5 And [Flags]=0 AND (Left$([Name],1) “~”) ORDER BY [Name];
Otherwise, this worked perfectly in Access 2007.
Thanks!Is there any way to exclude hidden queries from this list?
-
WSHansV
AskWoody LoungerOctober 23, 2008 at 3:05 am #1130049Apparently Access 2007 doesn’t set the Flags property any more. Here is another method:
Set the Row Source Type propery of the combo box to Value List.
Clear the Row Source property.
Create a function in a module:Function ListQueries() As String
Dim strList As String
Dim obj As AccessObject
For Each obj In CurrentData.AllQueries
If Not GetHiddenAttribute(acQuery, obj.Name) Then
strList = strList & “;” & obj.Name
End If
Next obj
If Not strList = “” Then
strList = Mid(strList, 2)
End If
ListQueries = strList
End FunctionSet the row source of the combo box in the On Load event of your form:
Private Sub Form_Load()
Me.cboQueries.RowSource = ListQueries
End Subwhere cboQueries is the name of the combo box.
-
WSodeus
AskWoody LoungerOctober 23, 2008 at 4:11 am #1130057Hans, I received an error message when trying to implement your latest solution (“The recordsource specified on this form or report does not exist”), even though your list contained valid query names. I also found that the new list still contained ALL the queries, so I did some digging. Interestingly, all the queries that were set to hidden (and do not show if the options are set to hide them) do not actually have the “hidden” flag set anymore. I checked every hidden query and found the same problem. So I “re-hid” every hidden query, and your original solution works perfectly. I’m not sure if this is going to happen regularly. I’ve found a number of interesting new “features” in Access 2007 that I don’t like, but this customer insists on using the new product.
Thanks for your help. I’m sticking with the original solution of assigning the recordsource directly from within the properties of the combo box. I’ll have to monitor how/when/why Access now seems to remove this flag from the properties.
-
WSjohnhutchison
AskWoody Lounger -
WSHansV
AskWoody Lounger
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
4 Strange Facts About Тостер За Сандвичи (Awaiting moderation)
by
rosalinepettey6
1 hour, 52 minutes ago -
Windows 11 blocks Chrome 137.0.7151.68, 137.0.7151.69
by
Alex5723
10 hours, 15 minutes ago -
Are Macs immune?
by
Susan Bradley
7 hours, 38 minutes ago -
HP Envy and the Function keys
by
CWBillow
13 hours, 20 minutes ago -
Microsoft : Removal of unwanted drivers from Windows Update
by
Alex5723
21 hours, 32 minutes ago -
MacOS 26 beta 1 dropped support for Firewire 400/800
by
Alex5723
21 hours, 49 minutes ago -
Unable to update to version 22h2
by
04om
8 hours, 32 minutes ago -
Windows 11 Insider Preview Build 26100.4482 (24H2) released to Release Preview
by
joep517
1 day, 5 hours ago -
Windows 11 Insider Preview build 27881 released to Canary
by
joep517
1 day, 5 hours ago -
Very Quarrelsome Taskbar!
by
CWBillow
15 hours, 9 minutes ago -
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
1 day, 18 hours ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
1 day, 7 hours ago -
Is your battery draining?
by
Susan Bradley
4 hours, 58 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
5 hours, 21 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
1 day, 22 hours ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
1 day, 6 hours ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
1 day, 6 hours ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
23 hours, 5 minutes ago -
National scam day
by
Susan Bradley
5 hours, 31 minutes ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
1 day, 2 hours ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
2 days, 23 hours ago -
Tools to support internet discussions
by
Kathy Stevens
1 day, 11 hours ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
2 days, 14 hours ago -
AI is good sometimes
by
Susan Bradley
3 days, 6 hours ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
2 days, 20 hours ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
4 days, 6 hours ago -
June KB5060842 update broke DHCP server service
by
Alex5723
4 days, 5 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
4 days, 9 hours ago -
Excessive security alerts
by
WSSebastian42
3 days ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
4 days, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.