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

    Using Dsum in TextBox

    I am stumped - that I was on the right track.


    I have a Query: MgrAnnualReportQ
    I have a Report: AnnualResultsMgr

    The Query takes a filter from a ComboBox on a form - (choose the Mgr then press button to run report)
    If I run the Query and put in the Mgr (enter Parameter value) - the query runs fine.
    Then I run the report (entering the parameter value)
    with this Dsum formula in the Expression Builder for the Control Source for a Text Box:
    Code:
    =DSum("[DealRevenue]","[MgrAnnualReportQ]","[InvoiceMonth]=1 And [InvoiceYear]=Year(Date())")
    Access shows "calculating" and then returns #error in the report.

    Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Is InvoiceYear a text or number type field?
    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
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    it is a calculated field that returns an integer - I set the field type as number - re ran the report and got #ERROR

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Calculated field in table? Don't know why it fails for you. I just tested and it works for me. However, not using a query as the source, just table.

    If you want to provide db for analysis, 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.

  5. #5
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Here is a test file - I am sure that it is a simple fix?
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    In the posted db, the DSum references field Revenue but neither Deals table nor SalesQ have that field. They have SalesRevenue.

    Don't need the Rep field in the query twice.
    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
    Okay - changed the field to [SalesRevenue]
    And deleted the unfiltered Rep field from query

    Still returning error.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    I made those same two edits in your posted db and it works.

    Also, the RowSource for the combobox does not need the GROUP BY clause.
    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
    Racking my brain - still not working. If you see what I am doing wrong - Please let me know...
    Attached Files Attached Files

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Here's what I did.

    1. downloaded and opened db, opened ChooseRep form

    2. selected rep Andy in combobox

    3. opened report - no error, value displayed is 175,000.00

    Cannot replicate issue. No idea why it fails for you.

    Still don't need the GROUP BY clause in the combobox RowSource, however, having it should not cause issue.
    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
    wow every time I open it (and put Andy) I get #Error in the Text box. I wonder if there is something wrong with my Access installation. Thanks for all the help

  12. #12
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Update - I was not opening through the form, just trying to shortcut it - Open report, respond to the Message Boxes asking for the info from the form, then getting errors
    As soon as I opened the form, filled in info and the used the button on the form to open the report - it worked.

    Lesson learned, Thanks for all the help.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-08-2014, 05:18 PM
  2. unbound textbox to bound textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-29-2013, 02:02 AM
  3. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  4. Replies: 8
    Last Post: 04-12-2013, 08:59 PM
  5. Replies: 17
    Last Post: 02-08-2012, 10:06 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