I’m using a database to track training dates and want to notify trainees about expiration of their training. I know how to use the SendObject function when the audience is fixed. Does anyone know how to use the results of a query to fill in the TO: line item of the send function? The result I’m looking for is running a query/report based on date criteria and sending an email to each trainee whose record shows up in the query.
![]() |
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 |
-
Send Object Command (Access 2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Send Object Command (Access 2000)
- This topic has 9 replies, 5 voices, and was last updated 23 years, 9 months ago.
AuthorTopicWSchrisseguin
AskWoody LoungerAugust 23, 2001 at 11:05 pm #359453Viewing 1 reply threadAuthorReplies-
WSchrisseguin
AskWoody Lounger -
WSchrisseguin
AskWoody LoungerAugust 30, 2001 at 4:34 pm #539899Charlotte,
Thanks for the reply, and yes you did understand the question. I have some code shown below but the “Set rs” line is giving me an ‘Invalid Argument’ when I run it. TEST-ALERT is a query name and USERID is a field name. It is suppose to build a string (strEmails) from the USERIDs in each record of TEST-ALERT and then send them a report. Any comments on the line and what may be causing the error? ThanksDim rs As Recordset
Dim strEmails As String
Set rs = CurrentDb.OpenRecordset(“Select UserID FROM [test-alert]GROUP BY UserID;”, dbOpenSnapshot)Do While Not rs.EOF
strEmails = strEmails & rs!UserID & “;”
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
DoCmd.SendObject acSendReport, “test-alert-report”, strEmails -
WSLonnieB
AskWoody LoungerAugust 30, 2001 at 5:14 pm #539907Chris, I am also not that experienced with VBA, but if I look at some code from examples I have seen, the Set rs that you have written isn’t the same. For example, here is the way I have seen it done.
sSQL = “Select distinctrow * From tbl_User_Setup Where UserName = ‘” & _
Me!txtUserName & “‘ and Password = ‘” & Me!txtPassword & “‘;”Set db = CurrentDb
Set rst = db.OpenRecordset(sSQL, dbOpenDynaset)Although I don’t know why it wouldn’t work, you have an SQL query querying your query [test-alert]. Now the only problem you may have is that you placed brackets around test-alert. Try running it without the brackets. If that doesn’t work, try the above example.
Also, in the Do Loop, I don’t think you need the rs.MoveNext, but I am not sure. Have fun.
-
WSShane Sargent
AskWoody LoungerAugust 31, 2001 at 1:11 pm #540038Lonnie:
The MoveNext method is needed, otherwise the Loop code will just hang out on the first record of the recordset. That is, if your name is the first name in the record set, without the MoveNext method, strEmail would end up as: Lonnie; Lonnie; Lonnie; Lonnie….and on and on and you never get to the end of the recordset (EOF = End Of File) ’cause you never leave the first record.
You’d think after having done this once you’d remember, but I’ve just spent nearly a full day wondering why my ASP page kept timing out only to find that I’d (mistakenly) deleted that all important MoveNext method. Oye!
-
-
WScharlotte
AskWoody LoungerAugust 30, 2001 at 8:47 pm #539956Since you’re using Access 2000, the problem may be in your references. If you have the default ADO reference set, then you’ll get an error on the Set rs = line because that’s DAO syntax. If you have both ADO and DAO references set, you’ll probably still get an error because the ADO reference is still the default and Access isn’t sure which flavor of recordset you’re trying to open.
Go into the VB Editor (Alt+F11 is fastest), Select references from the Tools menu, and see if you have a DAO 3.6 reference set. If not, find it in the list and click on it to set the reference. Then go to your code and change it like this:
Dim rs As DAO.Recordset
The compile the project and see if everything compiles properly. If it does, try running your code. If you still have a problem, post back with the specifics.
-
WSchrisseguin
AskWoody LoungerAugust 31, 2001 at 2:33 pm #540062Charlotte,
THAT fixed the SELECT line. The DAO 3.6 reference was not turned on. The subroutine continues and now halts on the last line (DoCmd.SendObject) with a runtine error 2282 “The formats that enable you to output data as a MS Excel, rich-text, MS-text, or HTML file are missing from the Windows Registry”
This one I don’t understand because I can manually output excel and HTML content though the DB without issue.
The rs strEmails loop is working correctly. When I mouse over the strEmails in the last line, the pop up window shows the content I’m looking for. -
WSFrancois
AskWoody Lounger -
WSchrisseguin
AskWoody Lounger -
WSFrancois
AskWoody Lounger
-
-
-
-
Viewing 1 reply thread -

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
-
Windows 11 ad from Campaign Manager in Windows 10 (Awaiting moderation)
by
Jim McKenna
44 minutes ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
9 hours, 23 minutes ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
11 hours, 15 minutes ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
14 hours, 23 minutes ago -
Mystical Desktop
by
CWBillow
14 hours, 37 minutes ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
9 hours, 23 minutes ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
4 hours, 48 minutes ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
1 day, 5 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
1 day, 8 hours ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
1 day, 6 hours ago -
What is wrong with simple approach?
by
WSSpoke36
23 hours, 16 minutes ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
1 day, 18 hours ago -
Location, location, location
by
Susan Bradley
8 hours, 35 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
1 day, 19 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
1 day, 10 hours ago -
June 2025 Office non-Security Updates
by
PKCano
2 days, 6 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
8 hours, 55 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
2 days, 6 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
2 days, 16 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
1 day, 19 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
3 days, 1 hour ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
3 days, 1 hour ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
2 days, 15 hours ago -
Firefox 139
by
Charlie
2 days, 7 hours ago -
Who knows what?
by
Will Fastie
1 day, 10 hours ago -
My top ten underappreciated features in Office
by
Peter Deegan
3 days, 2 hours ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
19 hours, 41 minutes ago -
Misbehaving devices
by
Susan Bradley
1 day, 21 hours ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
4 days, 8 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
1 day, 6 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.