Results 1 to 5 of 5
  1. #1
    GWILKIE is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3

    Emailing Muliple Reports

    I run a end of day report of daily sales by territory in NA. Currently I run a query to list the territories with sales then run a report for each territory listed showing their unique sales.
    I would like to create a macro that reviews the list of territories and then emails the report for each territory.
    Each territory has a macro with the report and email address loaded I just need something to execute the list.



    It is important that a report is not sent to territories with zero sales so just sending a report to everyone will not work.

    I was thinking maybe a if statement could be used in a macro. I have good knowledge of MS Access 2010 but do not work in SQL I need the basics.

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Yes, you can make macros work conditionally. http://msdn.microsoft.com/en-us/libr...ffice.14).aspx

    You'll make a macro that conditionally executes your other macros. You'll probably use DCount(something)> 0 or DSum(something) > 0 to determine whether the (sub)macros for each territory should be run.

  3. #3
    GWILKIE is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3
    Thanks Dal for the help but this is what I was doing and I get a error message
    I am using the IF[ASN query list]![Salesperson]=1 then rum macro related to Territory 1
    Unfortunately I get an error that says it cannot find the [ASN query list]![Salesperson]

  4. #4
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    What is [ASN query list]![Salesperson]?
    Is "ASN Query List" the name of a form? If so, try using Forms![ASN query list]![Salesperson].

  5. #5
    GWILKIE is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3
    It was a Query, I tried making a table and using the builder to point to the Salesman field but i get the same message that it cannot find the ASN table

    here is the code
    With CodeContextObject
    If (.[asn list]!Salesperson = 1) Then
    DoCmd.RunMacro "M_email ASN 01", , ""
    End If

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Minimum from muliple tables
    By inhops in forum Access
    Replies: 2
    Last Post: 05-23-2013, 10:58 PM
  2. Emailing reports from access
    By doopml in forum Programming
    Replies: 3
    Last Post: 10-24-2012, 11:18 AM
  3. Replies: 2
    Last Post: 05-20-2011, 10:18 AM
  4. Emailing forms or reports
    By dcecil in forum Reports
    Replies: 6
    Last Post: 12-16-2009, 07:57 AM
  5. Muliple If, Then Statements
    By jrockusa in forum Access
    Replies: 2
    Last Post: 12-06-2009, 11:06 PM

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