Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Email a Value From Report
Jon Capps 
       
4 years ago
Is there a way to reference a value from a report and place that value in the body of a email?

Jon Capps OP  @Reply  
       
4 years ago

Kevin Robertson  @Reply  
           
4 years ago
Send Outlook Email. The extended cut shows how to add values to your Emails.
You will probably also need the DCount function to total up the assignments.
Adam Schwanz  @Reply  
           
4 years ago
Sure, just use a DSUM, covered in expert 11 I believe

Use the criteria for whatever is making that number. So like
DSUM("Assignments","Table","Date= whatever your using here, an entered field or a form on the field, not sure how you have it setup)
Adam Schwanz  @Reply  
           
4 years ago
Yea Dcount, not DSUM. Woops LOL, might get slightly different answers
Jon Capps OP  @Reply  
       
4 years ago

Jon Capps OP  @Reply  
       
4 years ago
What am I doing wrong, life is just a struggle...
Alex Hedley  @Reply  
           
4 years ago
DCount('DateAssign', 'NewDailyassign', 'DateAssign=NSDate')

DCount('DateAssign', 'NewDailyassign', 'DateAssign=' & NSDate)
Adam Schwanz  @Reply  
           
4 years ago
You need to assign that to something, something = DCOUNT

Either a field or a variable like

FieldName = DCOUNT....
Alex Hedley  @Reply  
           
4 years ago
You are saying does DateAssign have the value of a hardcoded string of 'NSDate' not the variable
Jon Capps OP  @Reply  
       
4 years ago

Jon Capps OP  @Reply  
       
4 years ago
Closer to an answer, but still not quite there, any suggestions?
Jon Capps OP  @Reply  
       
4 years ago

Jon Capps OP  @Reply  
       
4 years ago
Guess you need some context, of where the email body is getting the value
Adam Schwanz  @Reply  
           
4 years ago
What's your dcount look like now?
Adam Schwanz  @Reply  
           
4 years ago
I'm blind never mind LOL. Try
DailyAssignments = DCOUNT("ID","NewDailyAssign","DateAssign=#" & 3/11/2022 & "#")
Jon Capps OP  @Reply  
       
4 years ago

Jon Capps OP  @Reply  
       
4 years ago
I have tried both ways I keep getting zero
Adam Schwanz  @Reply  
           
4 years ago
You tried with the pound signs (#) outside of the date like in my example?
Jon Capps OP  @Reply  
       
4 years ago
Dailyassignments = DCount("ID", "NewDailyassign", "DateAssign=#" & "3/11/2022" & "#")

that got me 7, now to make it work as a variable for the date
Kevin Robertson  @Reply  
           
4 years ago
I suspect you may have times in DateAssign but it is formatted as a date.

DailyAssignments = DCount("DateAssign","NewDailyassign","DateAssign>=#2022-03-11# And DateAssign < #2022-03-12#")

Note: I wouldn't hard code the dates otherwise you will have to change them in your code everyday.
Hint: Use a form field.

Jon Capps OP  @Reply  
       
4 years ago
Dailyassignments = DCount("ID", "NewDailyassign", "DateAssign=#" & DateSearchAssgnReport & "#")

I finally got it to work!! thank you

I have a message Box that pops up, and I fill in that date, then I have a report and an email generated with embedded table, attaches a PDF report.

All I had to do was redo my code to use the  message Box variable in the Dcount for the search critera.

Phew! I keep trying to learn but gosh darn it I am slow!
Alex Hedley  @Reply  
           
4 years ago
Date formats are fun
Adam Schwanz  @Reply  
           
4 years ago
Glad to hear it works :). And yea I hate the pound symbols LOL

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 7:25:44 AM. PLT: 1s