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, 8 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
-
Sometimes I wonder about these bots
by
Susan Bradley
47 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
2 hours, 45 minutes ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
3 hours, 45 minutes ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
3 hours, 10 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
3 hours, 52 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
6 hours, 27 minutes ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
6 hours, 28 minutes ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
21 minutes ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
14 hours, 36 minutes ago -
0Patch, where to begin
by
cassel23
8 hours, 38 minutes ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
1 day, 4 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
15 hours, 59 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
1 day, 12 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
1 day, 3 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
14 hours, 53 minutes ago -
Installer program can’t read my registry
by
Peobody
9 hours, 50 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
1 day, 1 hour ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
1 day, 8 hours ago -
False error message from eMClient
by
WSSebastian42
1 day, 23 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
2 days, 8 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
2 days, 10 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
1 day, 6 hours ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
2 days, 13 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
1 day, 14 hours ago -
Outdated Laptop
by
jdamkeene
2 days, 19 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
3 days ago -
Another big Microsoft layoff
by
Charlie
3 days ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
2 hours, 22 minutes ago -
May 2025 updates are out
by
Susan Bradley
4 hours, 4 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
3 days, 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.