Results 1 to 4 of 4
  1. #1
    kstyles is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    24

    where condition within a macro

    I am trying to have a multi clause where condition within a macro. What I am doing is setting up a macro to pull reports for individual persons. If the persons name is blank then I do not want the report to pull.



    Here is my initial where condition in the macro:

    [General_outstanding Item Query]![Relationship Manager]="Jane Doe"

    If I add the Not IsNull at the beginning when I click off the row it is deleted (the Not IsNull) portion.... if I put it after it brings up a box for me to enter a value for the "null" record.

    I have entered the values for each individual person because I want to e-mail them their reports seperately in a PDF... I can get their reports to export, but I do not want blank reports...

    Any hints?

  2. #2
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    Are you trying to see if the report is blank before you generate and email it? I'm not sure how to test that in a macro....but if you use vba, you could test if the records exist for each person. One way would be to use a dlookup function.

  3. #3
    kstyles is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    24
    Yes, in a way - I don't even want the report to be generated if it is blank. Would a dlookup still work?

  4. #4
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    Yes, it would work or dcount....dcount("fieldname","tablename","[id]=" & [id])

    something like that.

    if dcount("fieldname","tablename","[id]=" & [id]) > 0 then docmd.openreport....

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

Similar Threads

  1. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  2. Macro Condition
    By eww in forum Programming
    Replies: 5
    Last Post: 08-27-2010, 10:59 AM
  3. Like condition for 1 column help pls!
    By stodd in forum Queries
    Replies: 1
    Last Post: 03-14-2010, 01:51 AM
  4. hours + condition
    By Miriam in forum Queries
    Replies: 0
    Last Post: 08-09-2009, 06:46 AM
  5. How to use IIF condition
    By nshaikh in forum Queries
    Replies: 4
    Last Post: 09-12-2008, 01:23 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