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
-
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
3 hours, 51 minutes ago -
Manage your browsing experience with Edge
by
Mary Branscombe
4 hours, 29 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
10 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
40 minutes ago -
Apps included with macOS
by
Will Fastie
7 minutes ago -
Xfinity home internet
by
MrJimPhelps
9 hours, 21 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
11 hours, 20 minutes ago -
Debian 12.11 released
by
Alex5723
19 hours, 47 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
23 hours, 28 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 hours, 54 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
19 hours, 56 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
1 day, 16 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
1 day, 6 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 19 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
1 day, 11 hours ago -
Some advice for managing my wireless internet gateway
by
LHiggins
18 hours, 52 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
11 hours, 44 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
2 days, 4 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
2 days ago -
Does windows update component store “self heal”?
by
Mike Cross
1 day, 14 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
2 days, 18 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
1 day, 2 hours ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
15 hours, 5 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days, 21 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days, 21 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
2 days, 9 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
3 days, 5 hours ago -
0Patch, where to begin
by
cassel23
2 days, 23 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days, 18 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
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.