Solved Email .HTMLBody to include totals from other Modules or Queries? (1 Viewer)

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
Okay, I just read through the posts. Are those two separate procedures populating an open form? If so, you should be able to refer to their values from your code by using a form reference. For example:
Code:
& "Total QTY of Edges: <U>" & Forms!FormName.WSToEd.Value & "</U><br>" _
Hope that helps...
Great, I will try later tonight as soon I can and report back. TY soo much
 

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
Okay, I just read through the posts. Are those two separate procedures populating an open form? If so, you should be able to refer to their values from your code by using a form reference. For example:
Code:
& "Total QTY of Edges: <U>" & Forms!FormName.WSToEd.Value & "</U><br>" _
Hope that helps...
I tried it but didnt worked. Do you think I may need to add a DIM as RecordSet?
It gave me an Error to debug

Ohhh also, these values are coming from a Closed form.
Maybe using the VBA posted at the beginning of the thread as reference will be a better approached? Since the VBA is getting values from a query. IDK :(
 
Last edited:

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
What was the error message?
Edit: This error happened because I had that form opened in Design View.
Discard this post, Next post is correct


1640795225679.png


1640795310618.png
 
Last edited:

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
Ohh wait, I had that form opened in Design View
here is the error I get

1640795519500.png


1640795549006.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,358
OMG God guys!!
That's it, thats the problem..

So I created the email report with the Forms Opened and @theDBguy code works perfect but Only works with Open Form not Closed

View attachment 97212
Unfortunately, you cannot pull any data from a closed form. So, yeah, if you want to pull the information from a form, it has to be open. Otherwise, you can try to pull it from the source table instead. Cheers!
 

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
Unfortunately, you cannot pull any data from a closed form. So, yeah, if you want to pull the information from a form, it has to be open. Otherwise, you can try to pull it from the source table instead. Cheers!
Ok, thanks sooo much mate... I will dig into that to see what I come up to.
Should I post here if I make it work that way even though is not related to the thread title? @theDBguy
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,358
Ok, thanks sooo much mate... I will dig into that to see what I come up to.
Should I post here if I make it work that way even though is not related to the thread title? @theDBguy
If only to tell us you got it to work another way, it's okay to post here. However, if it was to ask a question about another approach, maybe it's better to start a new thread. Good luck!
 

TecknoFreak

Member
Local time
Today, 13:57
Joined
Dec 21, 2021
Messages
57
I was thinking,
Is it possible to have those 2 Forms open in the background (Hidden) once you open the database front end?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,358
I was thinking,
Is it possible to have those 2 Forms open in the background (Hidden) once you open the database front end?
Yes. How do you normally open them now?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,358
as a new tab but never actually open it because I run the report from a Dashboard button that populate the Report and a Form with a Click.
Not sure what you mean by "a new tab," but if you're using a Click to open the report that needs the form as well, then you should be able to add code to open the form as hidden first, before opening the report.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,358
Not sure what you mean by "a new tab,"
By that, I mean, I was hoping you would tell me you double-click on the form's name on the Navigation Pane, or you click on a button from your menu form, etc.
 

Users who are viewing this thread

Top Bottom