Run time error 2482

  • Thread starter Thread starter Guest
  • Start date Start date
G

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?
 
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
 
That did it! I would never have thought of "" as a problem.

Thanks
--
SailorMike


Steven M. Britton said:
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


Sailormike said:
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?
 
Back
Top