Results 1 to 5 of 5

Thread: Suppress #Error

  1. #1
    Join Date
    Jun 2004
    Posts
    10

    Unhappy Unanswered: Suppress #Error

    I have the following in the beforeupdate event of a text field:
    Code:
    Private Sub runningsum_BeforeUpdate(Cancel As Integer)
    Sub CheckValue()
        Dim frm As Form, ctl As Control
        Dim varResult As Variant
    
        ' Return Form object variable pointing to frm_main_tip_form form.
        Set frm = Forms!frm_main_tip_form
        ' Return Control object variable pointing to runningsum.
        Set ctl = frm!runningsum
        ' Choose result based on value of control.
        varResult = IIf(Nz(ctl.Value) = "", _
            "No value", "Value is " & ctl.Value)
        ' Display result.
        MsgBox varResult
    End Sub
    But still receive the #Error

    The data field of runningsum contains:
    Code:
    =DSum("totalsales","tbl_tips"," [transdate] = #" & [transdate] & "#")
    Any suggestions about what I'm doing wrong?

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    varResult = IIf(Nz(ctl.Value) = 0, _
    "No value", "Value is " & ctl.Value)




  3. #3
    Join Date
    Jun 2004
    Posts
    10

    Where?

    Do I put it into the BeforeUpdate field? If not, where does it go?

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Well I suppose it all depend on what you want to do with the data...but sure...why not.

  5. #5
    Join Date
    Jun 2004
    Posts
    10
    I put it into the before update and that didn't work at all.

    Any other ideas where to put it?

Posting Permissions

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