Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19

    Automated Email Question

    On one of my forms, I have a macro-enabled button called "Submit Report" which generates and sends an email via Outlook on-click. The code for the body of the email is as follows:



    =IIf([Form].[Description].[TextFormat]=1,PlainText([Description] & "Reported by: " & [Reported by]),[Description] & " Reported by: " & [Reported by])

    Now I tested the email and "Reported by" populates the auto number instead of the actual employee name. How can I change the code where it populates the employee name?

    "Reported by" row source is: SELECT [Contacts Extended].ID, [Contacts Extended].[Group Name] FROM [Contacts Extended] ORDER BY [Contacts Extended].[Group Name] (a query)

    Form record source is: Task (a table)

    Any help would be much appreciated!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It looks like you may be using Lookup Fields: http://access.mvps.org/access/lookupfields.htm

  3. #3
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    Correct. I read that article, but not much help how to go about modifying the code I provided. Or do I change from lookup to something else? Employees need to selecte their name from dropdown box. So I am confused.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Lookup's (combo boxes) on a form are just fine and very useful. When in a field in a table, they hide what is really in the table and make it difficult to figure out what to do. http://www.btabdevelopment.com/ts/removelookups

  5. #5
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    I just did that, but the body of my email is still kicking out the auto ID instead of the employee name. Again...this is what i have for the body of my email :
    =IIf([Form].[Description].[TextFormat]=1,PlainText([Description] & "Reported by: " & [Reported by]),[Description] & " Reported by: " & [Reported by])
    The reported by is where my problem lies....it pulls from a query...and pulls the auto id instead of the name

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You need to modify your existing query to join the other table on the [Reported by] field and then add in the actual field you need and use *that* instead of the [Reported by] field which only contains the PK of the other table.

  7. #7
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    I added the "Task" table to my "Contacts Extended" query as you suggested .... It automatically had joined "Assigned To" (task table) to "ID" (contacts table) .... I then joined "Reported By" (task table) to the same "ID" (contacts table) as you suggested, but it still didn't work ... as a matter of fact, doing that removed the "Reported By" values from my form.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    We're going around in circles. If you want to zip up your db and attach it to a post we could look at it to see what is going on. Remove any sensitive data of course.

  9. #9
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    See attached. Sections that I am talking about are, that I need your review on are these:

    1-"Task Details" form - Email button ..... when email is generated, as you will see, the "Report By" in the body pulls the "ID" value instead of the employee name

    2-It's also doing the same thing in the "Completed Tasks By Date" report - cateory tab ..... it pulls ID rather than catgory value

    Appreciate your help with this RG ... I've modified/set up everything else, DB is working fine, and have already rolled out the DB, but it's just these two minor issues I am having.
    Attached Files Attached Files

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm not sure the purpose of a Locked Combo Box on the [Task Details] but the easiest way I found to resolve this issue was to add an invisible TextBox (orange) set to the value you want and reference that control in the Macro instead of the cbo. There was a lot of redirection in your design and I chose to not attempt to understand it but instead find a solution that would not break something else. I'll look at your next issue next.
    Attached Files Attached Files

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I might also add that Access defaults the name of a bound control to the name of the field to which it is bound. Then can easily get confused when you reference it because there are two elements with the same name. I usually rename my controls as to the type of control and the bound field name (txtBoundField). Then I know what type of control and to what it is bound. I do not think this is currently causing you problems but it sure could in the future.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As for the report, I added the lookup table to the Completed Tasks query and added the Contacts Name to the query and referenced it in the report instead. I don't think that will break anything else in your system.
    Attached Files Attached Files

  13. #13
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    Hey, RG ... Thanks mate! ... The email works exactly as I would like. Appreciate that! But the report is doing the same thing, no changes. On the "Completed Tasks by Date" report it still shows the ID value under the "Category" heading. The heading is labeled "category" but the field is actually the "title" field.

  14. #14
    siggybaby_18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Clarksville, TN
    Posts
    19
    I only used the "Completed Tasks by Date" for you to see what I am talking about, but essentially all the reports are pulling the ID value instead of the actual "category" value that I would like to see. The category values are listed in the "Categories" table.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Okay, I see what you are talking about. I altered the RecordSource of the Completed Tasks by Date and changed where the report was picking up the "title". The same thing should be able to be done to the other reports.
    Attached Files Attached Files

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automated Email using Outlook
    By imran688 in forum Programming
    Replies: 25
    Last Post: 11-12-2012, 03:02 AM
  2. Automated Email Notification
    By sai_rlaf in forum Access
    Replies: 5
    Last Post: 12-07-2011, 06:33 PM
  3. automated email sent from records in form
    By hmcquade in forum Forms
    Replies: 2
    Last Post: 05-23-2011, 08:45 AM
  4. Automated email from access
    By jfuller in forum Access
    Replies: 3
    Last Post: 04-11-2011, 02:56 PM
  5. Replies: 1
    Last Post: 03-02-2010, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums