Results 1 to 12 of 12
  1. #1
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141

    DLookup In Report only showing on first line

    I have a report based on a query. there is an unbound TextBox that contains a DLookup.
    It works perfect on the first line - but is blank on all the other lines.
    The query that the DLookup is using does contain the information for all lines.

    Any Ideas?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    Don't use DLOOKUP in a query. The qry itself is a lookup.
    use a join to pull data from other tables. Hence DLOOKUP.

  3. #3
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    the dlookup is in the report

  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,894
    Need something to analyze. Post code or db.
    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.

  5. #5
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Code:
    =DLookUp("[Revquota]","[Qury1TestQuota]","[RepID]=" & [TxtRep_ID] & "And [DateOfChange]=#" & DMax("[DateOfChange]","[Qury1TestQuota]","[DateOfChange]<=#" & DateSerial([TxtDealYear],[TxtMo],1) & "#") & "#")
    I have 1 query that returns all the deals that a manager's reps close for a month (which is used for Most of this report)
    and a separate query (Qury1TestQuota) that looks up the Quotas for all reps (this can change throughout the year. So each change has a DateofChange
    I have it working for the month January - where started each reps quota - Quotas won't be inputted until they change - lets say March.
    The Idea is: in February - it finds the last quota input for each rep before Feb 1st (in this case it should be the Jan quotas.
    It is just returning blanks.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,894
    One issue is need a space before the And operator so text doesn't run together in the compiled expression:

    & " And [
    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.

  7. #7
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Added the space. Still returning blanks - If I add a Date Of Change that is the same month as the DateSerial it fills in the Quota. But I daon't want to add a Quota Every Month - only the months it actually changes.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,894
    Not understanding this structure. If you want to provide db, follow instructions at bottom of my post.
    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.

  9. #9
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Here is an example DB (basically the same)
    Open the Choose Quarter form (I forgot to point the Command button to the report)
    Then open the Quarter report.

    The SubReports have the Dlookup I have been trying to figure out.
    Attached Files Attached Files

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,894
    I would set cboQtr properties:

    RowSource: 1;First;4;Second;7;Third;10;Fourth
    ColumnCount: 2
    ColumnWidths: 0";0.5"
    BoundColumn: 1

    Filter criteria in query for MODeal: cboQtr

    I select First and 2015 on the form and the subreports all show same data. If you want different quarter on each subreport, maybe calculate an adjustment to MODeal:

    =[MODeal] + 3
    =[MODeal] + 6
    =[MODeal] + 9
    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.

  11. #11
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    That is very much like how I have it in the real DB - I just threw this togethor quickly. What I ultimately want is a Quarter report that breaks out the months of the quarter. For this one I want to choose First Quarter and have it pull out January in subreport 1 February in 2 etc...
    This is working - the problem is the Quota - Each rep should always show a quota.
    But you see in the Subreport for January only the first rep does - and in the Feb subreport none do.

    That is where I was using the DLookup with 2 Criteria. Criterea 1: RepID Criteria 2: the last date that applies to the rep (that is before or equal to the Month (Date Serial))

  12. #12
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Figured it out! the Maxdate needs another Criteria - the way it is MaxDate will return the MAx date regardless of rep - By adding And RepID=Rep the Max Date is now the Max Date FOR THE PARTICULAR Rep

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

Similar Threads

  1. Replies: 2
    Last Post: 03-23-2015, 08:32 AM
  2. Replies: 15
    Last Post: 04-16-2014, 01:15 PM
  3. Replies: 4
    Last Post: 11-18-2013, 03:23 AM
  4. line chart not showing lines
    By ajetrumpet in forum Reports
    Replies: 0
    Last Post: 09-11-2010, 05:55 PM
  5. Replies: 3
    Last Post: 03-24-2006, 08:40 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