Results 1 to 5 of 5
  1. #1
    Sandy Gomez is offline Novice
    Windows 2K Access 2007
    Join Date
    Sep 2010
    Posts
    1

    include zero data where no record

    I have a table with budget and forecast information by task joined to another table with detailed actual info by task. On a report, I want to show the budget and forecast information even if there is no detailed actual information. How do I do this when there is no Task info in the detail table?



    Sample

    Task 1 John Doe 20 actual (detail table), 10 budgeted (b&f table), 20 forecast (b&f table)
    Task 2 (no record in detail table), 15 budgeted (b&f table), 30 forecast (b&f table)

    I tried a join to include all records from the b&f table and only those records from the detail table where the fields are equal, but it still leaves out the b&f info.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Other way around. You want everything in the b&f table and only what matches in the detail table.

    Also, look up the Nz() function to replace nulls with 0s.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    IMO, the NZ function will not help you (unless I'm understanding the question incorrectly). If there is no record, you can't pull it. I'm having the same problem, but I have my own function to fix it. I use it to manipulate the source tables because I have found no other interface solution.

    Your situation is easier though I think. At this point, you can certainly write a small function that adds new recs to table 2 based on whether the identifier from table 1 is in there or not.

    I would suggest doing that first. To fix this in the future, consider adding some code or something that automatically inserts a new record in table 2 when you create a new rec for table 1. If you use that sort of preventive measure today, you won't ever have to ask this question again.

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    What I understood was that she is getting

    20 10 20
    null 15 30

    and wants to replace the null with a 0. That's why I recommended the Nz() function

  5. #5
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    use an outer join in your query

    grNG

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

Similar Threads

  1. Replies: 0
    Last Post: 07-31-2010, 12:09 PM
  2. Add data from previous record if blank
    By mbc321 in forum Queries
    Replies: 1
    Last Post: 08-08-2009, 05:15 PM
  3. Replies: 9
    Last Post: 03-24-2009, 09:19 PM
  4. Find data, load data, and save as a new record
    By hawzmolly in forum Access
    Replies: 0
    Last Post: 10-05-2008, 03:18 PM
  5. How to display data from another record
    By rodrigo in forum Access
    Replies: 1
    Last Post: 07-24-2006, 07:29 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