Run time error 2482

Discussion in 'Access Macros' started by Sailormike, Apr 7, 2006.

  1. Sailormike

    Sailormike Guest

    This is one of those ‘Why in the world is that . . .’ questions.

    I have a macro attached to On_Current on frmLaurieSheet
    Macro reads: [txtbuyerfullname] Not Like "none†set value
    [Forms]![frmLaurieSheet]![cboAssignBuyer].[Locked] yes
    [txtbuyerfullname] Like "none" set value
    [Forms]![frmLaurieSheet]![cboAssignBuyer].[Locked] no

    I have saved the macro as a module, to get the code, and it reads:
    With CodeContextObject
    If (Eval("[txtbuyerfullname] Not Like ""none""")) Then
    Forms!frmLaurieSheet!cboAssignBuyer.Locked = True
    End If
    If (.txtBuyerFullName Like "none") Then
    Forms!frmLaurieSheet!cboAssignBuyer.Locked = False
    End If
    End With

    If I attach that code instead of the macro I get run time error 2482 can’t
    find “txtbuyerfullnameâ€
    Txtbuyerfullname is not visible but so what? I don’t see why it would matter
    but the default view for this form is datasheet.
    Why can a macro see what code cannot?
     
    Sailormike, Apr 7, 2006
    #1
    1. Advertisements

  2. It's a Quotes problem.. Try this.
    With CodeContextObject
    If (Eval(me.txtbuyerfullname <> "none")) Then
    Forms!frmLaurieSheet!cboAssignBuyer.Locked = True
    End If
    If (me.txtBuyerFullName = "none") Then
    Forms!frmLaurieSheet!cboAssignBuyer.Locked = False
    End If
    End With
     
    Steven M. Britton, Apr 7, 2006
    #2
    1. Advertisements

  3. Sailormike

    Sailormike Guest

    That did it! I would never have thought of "" as a problem.

    Thanks
    --
    SailorMike


     
    Sailormike, Apr 8, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.