Results 1 to 4 of 4
  1. #1
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26

    Form pulls totals from query

    I have a form... ugh don't we all... anyways, this form has a combo box we'll call it [username], I have a [date_start] and a [date_end] text box below it (not that placement matters).



    I have a query too... that the form is pulling information from, I have it so the query pulled reflects the value of whatever or I guess whomever is in [username], but for some reason I have the below expression in the criteria for the query column we'll call it [date]:

    between "#" & Format([Forms]![dateform]![date_start], "MM/DD/YYYY") & "#" AND "#" & Format([Forms]![dateform]![date_end], "MM/DD/YYYY") & "#"

    Well to no avail I can not think around this, the query finds this expression to large. So I wrote a filter in VBA on click it would do the following:

    Me.Filter = "adIDate between #" & Format([Forms]![yp_ipr_ipm]![date_start], "MM/DD/YYYY") & "# AND #" & Format([Forms]![yp_ipr_ipm]![date_end], "MM/DD/YYYY") & "#"
    Me.Filter = "[strEmp] Like '*" & [Forms]![dateform]![username] & "*'"
    Me.FilterOn = True

    Yet now I came across another problem that is totals, the fields that I have are all check boxes, fixed the sql so the -sum showed the trues as 1's, but my problem is that it is not totaling all the 1's up in the fields that I have set.

    Help!! lol

    Thanks in advance my brain is burnt and I just can't think around stuff right now.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Post the sql statement for analysis or provide the project itself. 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.

  3. #3
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26
    Here is the SQL statement:

    Code:
    SELECT yp_adv_data.ID, yp_team_ipm.strEmp, yp_adv_data.adIDate, -Sum([yp_adv_data].[adBox9]) AS SumOfadBox9, -Sum(yp_adv_data.ad216) AS SumOfad216, -Sum(yp_adv_data.adIBRep) AS SumOfadIBRep, -Sum(yp_adv_data.adOBRep) AS SumOfadOBRep, -Sum(yp_adv_data.adEmailChk) AS SumOfadEmailChk, -Sum(yp_adv_data.adSave) AS SumOfadSave, -Sum(yp_adv_data.adSaved) AS SumOfadSaved, -Sum(yp_adv_data.adReCall) AS SumOfadReCall, -Sum(yp_adv_data.adSME) AS SumOfadSME, -Sum(yp_adv_data.adSMEA) AS SumOfadSMEA, -Sum(yp_adv_data.adSMS) AS SumOfadSMS, -Sum(yp_adv_data.adSMSTA) AS SumOfadSMSTA, -Sum(yp_adv_data.adSMST) AS SumOfadSMST, -Sum(yp_adv_data.adIBCalls) AS SumOfadIBCalls, -Sum(yp_adv_data.ad30d) AS SumOfad30d, -Sum(yp_adv_data.adCA) AS SumOfadCA, -Sum(yp_adv_data.adPro) AS SumOfadPro, -Sum(yp_adv_data.adProA) AS SumOfadProA, -Sum(yp_adv_data.adSCall) AS SumOfadSCall, Sum(yp_adv_data.adRevCol) AS SumOfadRevCol, Sum(yp_adv_data.adNewRev) AS SumOfadNewRev, Sum(yp_adv_data.adReRev) AS SumOfadReRev, Sum(yp_adv_data.adImpRev) AS SumOfadImpRev
    FROM yp_team_ipm INNER JOIN yp_adv_data ON yp_team_ipm.strEmp = yp_adv_data.strEmp
    GROUP BY yp_adv_data.ID, yp_team_ipm.strEmp, yp_adv_data.adIDate
    HAVING (((yp_team_ipm.strEmp) Like [forms]![yp_teamli]![ipm_member]) AND ((yp_adv_data.adIDate) Between [forms]![yp_teamli]![date_start] And [forms]![yp_teamli]![date_end]));
    In the fields on the form it is not totaling the records it is only showing the value of the first record.

  4. #4
    seth.murphine is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    charlotte nc
    Posts
    26
    Never mind figured out what I was doing wrong, like I said my brain is dying here and I'm trying to keep it alive.

    I needed:

    Code:
    =sum(sumoffieldname)
    instead of

    Code:
    =sumoffieldname
    Thanks

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

Similar Threads

  1. Unusual Sub Totals & Totals in Groups.
    By Robeen in forum Reports
    Replies: 12
    Last Post: 03-20-2012, 08:55 AM
  2. Replies: 5
    Last Post: 12-06-2011, 11:18 AM
  3. Form pulls info from 2 tables.
    By Jonpro03 in forum Forms
    Replies: 6
    Last Post: 07-20-2011, 11:33 AM
  4. Report that Pulls from two Forms - Lending Library
    By Surferboy1500 in forum Access
    Replies: 8
    Last Post: 06-07-2011, 12:13 PM
  5. Replies: 1
    Last Post: 02-13-2010, 12:44 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