Forum Discussion
HenryD
Dec 16, 2024Copper Contributor
MS Access Email Report
Hi I have a Form that I can email as a report. There is an email address on the report that is automatically used as the 'sent to' address within Outlook. Is it possible to lookup a cc email address that is not on the form and add this to outlook also.
I am using linked Sharepoint tables for some of the dropdown inputs on the form, and all data is saved to Sharepoint. I am using the embedded macro function as below.
Thanks
No worries! We all started at the beginning!!!
2 Ways:
- Ctrl + G
- Atl + F11
- HenryDCopper Contributor
Daniel
I gave it another go, I didn't get the errors I previously got but I only returned blanks in outlook. I have attached a snip of how i filled out the formula. Could you please let me know where i am going wrong. Thanks.
Sorry for the delay, I'm not on this forum very often.
What happens if you try that in the VBA/VBE Immediate window? This is truly the best place to fiddle with creating a DLookUp and testing things until you get the result you're after. Then just copy it back into your Query/Macro/Form/Report.
Sorry I'm having a bit of a hard time with the image, but is there an underscore in the field name Email_Address in the table design, Or is it a space and therefore it should be "[Email Address]" in the DLookUp()?
Is Contract Number a String or a Numeric field? If it is numeric, then it should be "[Contract Number] = SomeValue" (no single quotes around the value).- HenryDCopper Contributor
Yes there is an underscore in the field name Email_Address. Contract Number type is 'Single line of text' in the Sharepoint List.
You may by now have noticed that i have very limited knowledge when it comes to computer programming, I have built the database to date via YouTube.
I am prob sounding very stupid but how do i open a VBA window for this button?
What about using DLookUp()?
=Nz(DLookup("[EmailAddressColumnName]", "[TableWhereItMayBeFound]", "[YourCriteria]='SomeValue'"), "")
- HenryDCopper Contributor
Daniel, Thanks for responding, i did try DLookUp after searching youtube for a solution but I have not been able to get it to work, I will try again using the above. Ill post an update of my progress.
Why not just use VBA and avoid all these headaches and limitations! Macros are just a pain to work with and are limiting, you are MUCH better served working with VBA directly.
I did do a few tests on my end and =Nz(DLookUp(), "") worked for me. I'd suggest testing it in the VBA Immediate Windows to ensure you have the proper names and it works, and then copy it into the Macro knowing that it is good.