Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    1

    #error returned in a text box

    Hey All

    I am attempting to convert an Access database from 2003 to 2007. I am having trouble convert on formula in the control source on a form. In a sub form I have a hidden Text box that counts the records returned in the sub form. This then is displayed on the main form and used in other calculations. When there is one or more records return everything is working fine. However, when there are no records returned, the Hidden Text box on the sub form returns a null value and the text box that is displayed on the main form returns a #Error message.
    I have searched and applied a work around that can be found here - http://allenbrowne.com/RecordCountError.html.

    Here are the different formulas that I have used.



    Text107 is the hidden text box which counts the records in the sub form.

    Formula used in the hidden text box (Text107) =IIf(FormHasData([Form]),Count([PaymentAmount]),0) - note - when there are no records returned this still displays a null value.

    Formulas that I have tried to display this on the main form -
    =[sub_member_payments].[Form]![Text107]
    =NZ([sub_member_payments].[Form]![Text107],0)
    =IIf([sub_member_payments].[Form]![Text107]=1 Or [sub_member_payments].[Form]![Text107]>1,[sub_member_payments].[Form]![Text107],0)

    Any Help on this is appreciated!
    Thanks all

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not familiar with Allan's method, but I wonder if "[Form]" needs to be the full reference:

    Forms!MainFormName.sub_member_payments

    I use this method:

    nnz function
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Dlookup ovewrite returned value
    By rchtan in forum Queries
    Replies: 1
    Last Post: 03-31-2012, 11:12 PM
  2. Replies: 1
    Last Post: 02-17-2012, 10:17 AM
  3. New to the Forum - No Rows Returned
    By clausont in forum Access
    Replies: 1
    Last Post: 02-09-2012, 12:11 PM
  4. Replies: 7
    Last Post: 08-31-2011, 05:09 PM
  5. Returned No Results Message Box
    By Swilliams987 in forum Queries
    Replies: 2
    Last Post: 02-04-2011, 12:07 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