Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: Trap report print errors

    my report displays fine but when i print it i get #Error on one field, this is a sub report field and the sub report prints fine, i tried on detial print and report error to show a msgbox but it does not display

  2. #2
    Join Date
    Mar 2007
    Posts
    277
    Why is the field giving you an error? See if you can fix that issue.
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Not enough to go on, other than to say that a #Error is not a coding error, it's something to do with a bad expression.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Mar 2007
    Posts
    277
    Sounds like it might be data sensitive. What expression do you have in your query or the report for this field?
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ^ You should fix your sig! "formum"
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Oct 2003
    Posts
    311
    The expression in the field that turns to #error when printed is:

    =Sum([Total Amount])-[txtCash]-[TxtAdjustment]

    txtAdjustment = =[CashAdj]![txtCurrent] ' subreport

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    causes of #error can be

    data error.. you are referrign to a column or variable which doesn't exists
    ...are you using option explicit
    datatype error, although Access does a pretty good job of coercing datatypes sometimes its asked to do to much. an example of this could be trying to coerce a text value as a numeric value.... if you are using a currency datatype or format then that could be the cause of the problem

    the best way of debugging this in my books is to put in some debug points int he reports on format event and then actually examine what values are being retrieved

    that could be a msgbox

    eg
    msgbox("Total Amount:" & [Total Amount] & vbcrlf & _
    "Txt Cash:" & [TxtCash] & vbcrlf & _
    .....etc.....

    you have a mix of values from the recordset and values form a text box, yet the value for the adjustment is being pulled form a table..... seems odd, might be best to have everything from one source.. eg all from tables.

    depending on your data you may need to rephrase the sum to be
    =Sum([Total Amount])-cdbl([txtCash])-cdbl([TxtAdjustment]) 'expressly coerce datatype to required type.. could be cCur..

    BTW Id also get into some good habits early don't use spaces in column names, it will bite you in the backside at some stage.
    HTH

  8. #8
    Join Date
    Oct 2003
    Posts
    311
    Quote Originally Posted by healdem
    causes of #error can be

    data error.. you are referrign to a column or variable which doesn't exists
    ...are you using option explicit
    datatype error, although Access does a pretty good job of coercing datatypes sometimes its asked to do to much. an example of this could be trying to coerce a text value as a numeric value.... if you are using a currency datatype or format then that could be the cause of the problem

    the best way of debugging this in my books is to put in some debug points int he reports on format event and then actually examine what values are being retrieved

    that could be a msgbox

    eg
    msgbox("Total Amount:" & [Total Amount] & vbcrlf & _
    "Txt Cash:" & [TxtCash] & vbcrlf & _
    .....etc.....

    you have a mix of values from the recordset and values form a text box, yet the value for the adjustment is being pulled form a table..... seems odd, might be best to have everything from one source.. eg all from tables.

    depending on your data you may need to rephrase the sum to be
    =Sum([Total Amount])-cdbl([txtCash])-cdbl([TxtAdjustment]) 'expressly coerce datatype to required type.. could be cCur..

    BTW Id also get into some good habits early don't use spaces in column names, it will bite you in the backside at some stage.
    HTH
    THanks so much for the help, the spaces in names are b4 i started, person who created application, didnt know much at all, yet came up with some really complicated calcs

  9. #9
    Join Date
    Oct 2003
    Posts
    311
    also i dont have a rpt format event in vba only
    Activate
    Deactivate
    Close
    NoData
    Open
    page
    error

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ok so I lied, in my defence yerhonner....
    its a while since I really worked closely with Access..

    its the reports detail on format event.

  11. #11
    Join Date
    Oct 2003
    Posts
    311
    hey no worry i apreciate the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •