In Access 2010, when trying to assign a textbox a value using VBA code I'm presented with this error:
Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
What I'm trying to do is record the date and time whenever a record is modified. I'm using the "Before Update" event to run
the following code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.txtDateChanged = Date
Me.txtTimeChanged = Time()
I don't know why it won't work. This is something that seems about as simple as it gets. I've Googled the error and
everyone is suggesting missing references and untrusted locations as the cause but neither of those apply to this as I have
no missing references and the location is trusted.
Am I missing something ridiculously obvious?
In the line "Me.txtDateChanged = Date", Access keeps removing the () behind Date, I don't know why because it leaves them for
Time(). I don't know if that has anything to do with the problem.
If it helps any, I have two different combo boxes on my form. I have one to select location. When you select a location it
limits the 2nd combo box's choices. When you make a selection from the 2nd combo box (serial number), the form goes to that
Wow...Out of curiosity, I just removed the () from "Me.txtTimeChanged = Time()" and it worked without error.
Sigh....I should have known it was something silly. Thank you everyone for thinking about it!