Results 1 to 3 of 3
  1. #1
    BDarden is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    1

    SQL/DLookup/Pulling the same field multiple times

    Hello All,



    I have the following expression: January: FormatPercent(DLookUp("[EOM]","OpsFeeDataQuery","[Audit Month]=1" And "AGENTID=[Enter AgentID]"),0)

    That I can not get to work it seems the best route for this would be to go with SQL which I thought would be this:
    Code:
    SELECT EOM FROM OpsFeeData WHERE AgentID=[Enter AgentID] and AuditMonth=1 AS January


    But I get error syntax/missing operator error message...

    My entire query thus far looks like this:


    Code:
    PARAMETERS [Enter Audit Year] Short, [Enter Agent ID] Short;
    SELECT EOM FROM OpsFeeData WHERE AgentID=[Enter AgentID] and AuditMonth=1 AS January
    FROM OpsFeeData INNER JOIN (((AgentData INNER JOIN AuditData ON AgentData.AGENTID = AuditData.AgentID) INNER JOIN OperationsAuditData ON AgentData.AGENTID = OperationsAuditData.AGENTID) INNER JOIN OpsAgentIdData ON AgentData.AGENTID = OpsAgentIdData.AGENTID) ON OpsFeeData.[Agent Name] = OpsAgentIdData.FEEREPORTID
    GROUP BY OpsAgentIdData.AGENTID, AgentData.AGENTNAME, FormatPercent(DLookUp("[%EOM]","OpsFeeDataQuery","[Audit Month]=1" And "AGENTID=[Enter AgentID]"),0)
    HAVING (((OpsAgentIdData.AGENTID)=[Enter Agent ID]));


    I need the query to have a field for each month (Jan, Feb, Mar, etc.) that pulls this info based on the parameters I have included a copy of my db also QA Database.zip

  2. #2
    mrojas is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Location
    Concord California
    Posts
    72
    Trying setting "Unique Values" property to Yes.

    Insert DISTINCT between SELECT and EOM

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why didn't the DLookup work? What happened?

    Try:

    January: FormatPercent(DLookUp("[EOM]","OpsFeeDataQuery","[Audit Month]=1 And AGENTID=" & [Enter AgentID]),0)

    I don't see an OpsFeeDataQuery object in the db. There are no records and the linked spreadsheets are not available so I cannot test queries.
    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. Using a table in a query multiple times.
    By vgillis in forum Queries
    Replies: 1
    Last Post: 03-05-2013, 01:29 PM
  2. DLookup with multiple field condition
    By agent- in forum Programming
    Replies: 4
    Last Post: 10-15-2011, 05:17 PM
  3. parameter prompting multiple times
    By sandyg in forum Access
    Replies: 1
    Last Post: 08-15-2011, 10:10 AM
  4. Form_Current() running multiple times
    By caddcop in forum Forms
    Replies: 0
    Last Post: 04-01-2011, 09:00 AM
  5. Replies: 5
    Last Post: 12-10-2009, 10:33 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