You can't assign a value to this object

  • Thread starter Thread starter LAS
  • Start date Start date
L

LAS

Me.txtWeekDay = fncWeekDay(Me.txtScore_Date)

This line of code works fine when triggered in the txtScore_Date_AfterUpdate
event after the data is changed by the user.

But when it is triggered in the form's load event by this

Call txtScore_Date_AfterUpdate

I get the error "You can't assign a value to this object."

txtScore_Date has a good date in it when the code executes. txtWeekDay is
an unbound text control.

Can someone tell me what I'm doing wrong?

TIA
LAS
 
Never mind.
I thought it was still working in the after update event, but it had stopped
there also. Problem fixed.
 
Me.txtWeekDay = fncWeekDay(Me.txtScore_Date)

This line of code works fine when triggered in the
txtScore_Date_AfterUpdate event after the data is changed by the
user.

But when it is triggered in the form's load event by this

Call txtScore_Date_AfterUpdate

I get the error "You can't assign a value to this object."

txtScore_Date has a good date in it when the code executes.
txtWeekDay is an unbound text control.

Can someone tell me what I'm doing wrong?

Why not make the default value of Me.txtWeekDay be this:

=fncWeekDay(Me.txtScore_Date)

That way you don't have to do anything in your OnLoad event.
 
Good idea! Thanks!

David W. Fenton said:
Why not make the default value of Me.txtWeekDay be this:

=fncWeekDay(Me.txtScore_Date)

That way you don't have to do anything in your OnLoad event.
 
Back
Top