Link to home
Start Free TrialLog in
Avatar of ShadowIT
ShadowITFlag for United States of America

asked on

After Update SendEMail

Hello Experts:

I have a Main tbl where I am storing a lookup leading to a User tbl. Within the User tbl I am maintaining:

User Name, User E-Mail, Manager & Manager E-Mail

I have set the Main tbl to display all of this information within its lookup, when a record is updated I was hoping to use this to notify the corresponding manager.

In other words, if Bob is the user then Bob's manager Joe would be notified because this relationship is maintained within the User table when a record is updated.

I have tried doing this various ways within the To field of SendEmail but no matter what I try it doesn't work. I typically get an error stating that "User" isn't defined. So =([Users].[ManagerEMail]) doesn't work and I cannot seem to define a path to [ManagerEMail] from the [Users] defined within my Main tbl which I suspect to be my issue. Not sure if there's a syntax to move you through specific columns within a lookup.

I suppose I could just add the manager's e-mail directly to the form that populates the tbl but I'd like to see if there's a way to leverage the existing relationship that already exists within my User tbl.

Any ideas would be much appreciated, thanks.
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

It would help to have more detail about the form design.

For this to work you have to someway read the information from the user table.  There are several ways to handle this. If you have the userID, you could use the DLookup() function to retrieve the email address.   If ther is a combo box on the for for selcting user then yu coudl add the email as a hidden column and reference it as needed.
Avatar of ShadowIT

ASKER

Thanks for your reply, actually this wouldn't be dependant on any form.  Although I do have a form that enters records into the main tbl; instead this would be based on the record state within the main tbl being updated.  

I can accomplish this by hardcoding an e-mail address with SendEmail macro as an AfterUpdate event, but I am looking to pulling this dymanically from my User tbl.

I can't do a DLookup() as this is a web database and I'm only able to use macros, no code allowed.  I was able to find a Lookup macro, perhaps this would work?  Unfortunately I am not sure of the syntax I should be using in the Where section.  Then I'd also need to know how to relate this back to the SendEMail macro.
Try saving the Manager Email to a String variable, and using that in your code.
Ah ... I missed that this was a web database. This new site skin is really hard to see. Still trying to get used to it.

I have not had any need for the web database feature of 2010.  

I did a little research and these may help:

http://www.access-programmers.co.uk/forums/showthread.php?t=196662

http://www.utteraccess.com/forum/Tempvar-Change-T-t1962140.html

FWIW: The AccessJunkie that has replied in the above links works on the Access Product Group at Microsoft.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect!