You can't assign a value to this object (1 Viewer)

OBBurton

Registered User.
Local time
Today, 05:14
Joined
Dec 26, 2013
Messages
77
I have a line of code that used to work and now does not. I must have changed something, but the only things I am aware of are cosmetic. The code is:
Public Sub ResetTime()
Dim DesiredVal As String
DesiredVal = "= 'Your last activity on Wilbur was at '" _
& " & Format(Now(),'Medium Time')"
DoCmd.Close acForm, "frmWarning"
Forms!frmHidden.TimerInterval = 900000
Forms!frmMain!txtTimeStamp.Value = DesiredVal
Forms!frmHidden!chkActive = True
End Sub

It crashes on "Forms!frmMain!txtTimeStamp.Value = DesiredVal" line with a "You can't assign a value to this object", error #2448. If I comment this line out the code works perfectly, but as I said before it used to work the way I intended with the line.

Can somebody give me a clue how to troubleshoot the problem? :confused: It would sure be appreciated!
 
Last edited:

vbaInet

AWF VIP
Local time
Today, 12:14
Joined
Jan 22, 2010
Messages
26,374
You have a "=Date()" or "=Time()" or "=Now()" function in the Control Source of the textbox.
 

OBBurton

Registered User.
Local time
Today, 05:14
Joined
Dec 26, 2013
Messages
77
Thanks for the input!
I always have had a Now() in the txtTimeStamp text box and it worked flawlessly until I changed something and your response led me to the culprit. The problem was that the line should have read Forms!frmMain!txtStamp.ControlSource. I have no idea when or why I changed it, but change it I did and now that I have corrected it, it works great!
Thanks again!
 

Users who are viewing this thread

Top Bottom