Run time error 2482


S

Sailormike

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?
 
S

Steven M. Britton

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
 
Ad

Advertisements

S

Sailormike

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?
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top