Results 1 to 11 of 11
  1. #1
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43

    want #type! to show 0


    Hey all,

    is there a way to say =Field1*field2 if error show 0
    Hope below might help visualize
    Field 1 Field 2 =Field1*field2
    100% 20 20
    80% 10 8
    #Error (because of no data) <this is fine 20 #type!

    Under that 3rd field I try and add the 3 up but when I do I get #type!

    they each have their own textbox just wanted to try and simplify on here all with same names.

    I tried =Sum(if(field1*field2,0)) but that did not fly

    Thanks for your time and help.
    Last edited by tareyj8569; 08-28-2015 at 09:42 AM. Reason: mistake on error

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Need to deal with the #Error. What is this calc and why is there an error?

    If() is not a valid function. There is an IIf() function but regardless, that won't work in your expression either.
    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
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    oops I meant IIf but yea.

    The error I have is field1 that is pulling from a Subform but sometimes there is no data in the Subform so it throws an #Error

    Field 1
    =[ABC_Subform].[Form]![Text101]

    Field 2 is an unbound box with a number Ex: Text102 and is 20 in the field

    3rd field calculates the 2
    =[Field1]*[Field2]

    If there is data in field 1 because subform has data field 3 works just fine
    but if there is no data in subform it throws up the #Error in field 3

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Still don't understand your 'fields'. Are you pulling values from 3 subforms? Are these really 3 sets of UNBOUND textboxes - not 1 set of BOUND textboxes and 3 records?
    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
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    Yes sorry 3 unbound fields

    First field is getting % from subform
    2nd field is an unbound number
    3rd field is first field*2nd field

    so if field 1 is 100% and field 2 is 8 than field 3 would be 8


    Field 1
    Unbound =[ABC_Subform].[Form]![Text101]

    Field 2
    Unbound = 8

    Field 3
    Unbound =[Field1]*[field2] This would equal 8

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    You mean unbound CONTROLS (textboxes)?

    Aggregate functions cannot reference controls, only fields. So the Sum() won't work.

    I still don't understand the 3 rows of data.

    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.

  7. #7
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    Sorry need to get my naming convention down better.

    3 Unbound Controls which are textboxes

    the 1st textbox on mainform
    is pulling from a subform field that is being calculated in a textbox but sometimes that subform has no data so there is nothing to pull

    Subform textbox which is calculating a field on subform
    =Sum(IIf([Pass or Fail]="Pass",1,0))/Sum(IIf([Pass or Fail],1,0))

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    I am still lost. Why does your example show 9 pieces of data? If there are only 3 UNBOUND controls, how can there be 3 rows of data with different values? I think you better provide 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.

  9. #9
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    OH

    I should not have shown all 9 fields just the bottom line with the error. I included the other 2 which use the same calculation as I provided to show how it would look if it worked right.

    There is actually many subforms and so on but I wanted to include how it should look if it worked right.

    =Sum(IIf([Pass or Fail]="Pass",1,0))/Sum(IIf([Pass or Fail],1,0)) is used in all 3 subforms to get my total which then the percentages textboxes each pull from a different subform

    The first 2 rows there is data in the first 2 subforms so it shows like below
    but the 3rd row there is no data so the 3rd subform does not show
    Percentages Number =Field1*field2
    [Textbox1]=100%
    Textbox1,2,3 pull from subform1
    [Textbox2]=20 [Textbox3]=20
    [[Textbox4]80%
    textbox4,5,6 pull from subform2
    [Textbox5]=10 [Textbox6]=8
    #Error (because of no data) <this is fine
    textbox7,8,9 pull from subform3
    [Textbox8]=20 [Textbox9]#type!
    The above is 9 textboxes all unbound

    I apologize again I am not the best at describing my issue so I try to include probably too much.

    If you still need a DB, It will be a few for I have to recreate that section because this one here wont show unless on local network.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    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
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    June,
    Again you have solved one of my problems, there was some VBA code I got through the link you provided.
    Thank you for your time that you spent helping me with this issue.

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

Similar Threads

  1. Field Type of type-Double/Float
    By McArthurGDM in forum Access
    Replies: 3
    Last Post: 12-10-2014, 01:54 PM
  2. Replies: 2
    Last Post: 07-21-2014, 08:47 AM
  3. Replies: 3
    Last Post: 01-31-2014, 09:13 AM
  4. IF ID Is not Null show TYPE from other table
    By superjeff in forum Access
    Replies: 5
    Last Post: 09-14-2012, 09:45 PM
  5. Replies: 2
    Last Post: 03-18-2010, 08:24 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