Results 1 to 4 of 4
  1. #1
    Jessica240 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    95

    Emailing Database Objects

    Hello all!

    I am creating a macro which will open and email a report to a group of co-workers. The control source for the report is a query that has a parameter as the criteria.
    Click image for larger version. 

Name:	PARAMETERS.PNG 
Views:	11 
Size:	12.8 KB 
ID:	19758

    In the macro, I have several different values that are used as the parameters to populate the query which then feeds into the report.




    There will be times when the database will not have any data that matches the parameter criteria. When this happens, a blank report is sent. My goal is to find a way to only send reports with data and avoid sending blank reports.

    So is there some way I can tell Access to only send the email if the value is not null?

    Click image for larger version. 

Name:	isnotnull.PNG 
Views:	11 
Size:	12.9 KB 
ID:	19759

    Thanks for the help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Jessica240 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    95
    Thanks. The problem is that I am completely new to macros and have never used VBA. I've been trying to teach myself online and so far this link has been pretty helpful https://msdn.microsoft.com/en-us/lib...ffice.14).aspx

    But still, macros are so foreign to me so I really have no idea what I'm doing. All I can do is very basic actions such as open report, email report, close window. So when I read these forum posts, it all looks like alien language and is far too advanced for my amateur brain to understand.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't use macros, only VBA.

    Those threads suggest an If Then conditional structure in VBA code. I know macro has equivalent.

    The conditional code uses a DCount domain aggregate function (DLookup would work as well) to determine if report will have records after filter criteria is applied.

    You will have to explore If Then conditional in macro and domain aggregate functions.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Sharing Objects with a secondary database.
    By jerepois in forum Access
    Replies: 3
    Last Post: 08-18-2014, 01:56 PM
  2. Replies: 43
    Last Post: 03-27-2014, 01:51 AM
  3. Get objects selected in the database window
    By jptros in forum Programming
    Replies: 2
    Last Post: 08-02-2012, 04:39 PM
  4. Replies: 9
    Last Post: 12-02-2011, 08:52 AM
  5. Cannot import objects from secured database
    By focosi in forum Security
    Replies: 2
    Last Post: 09-10-2011, 02:33 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