Rotten Peaches
New member
- Local time
- Today, 03:23
- Joined
- Jul 18, 2012
- Messages
- 8
In Access 2010, when trying to assign a textbox a value using VBA code I'm presented with this error:
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?
PS.
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.
PPS
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 specific record.
SOLVED:
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!
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:Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
DoCmd.SetWarnings (WarningsOff)
Me.txtDateChanged = Date
Me.txtTimeChanged = Time()
End Sub
Am I missing something ridiculously obvious?
PS.
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.
PPS
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 specific record.
SOLVED:
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!
Last edited: