Can't assign value to this object ERROR

lmangano

New member
Local time
Today, 12:30
Joined
Nov 29, 2000
Messages
6
I'm not sure why I'm having such a hard time with this because I've done it before with a combo box, but when I use the following code with a text box, I get the "Can't assign value to this object." If the user doesn't enter a pend date, I want it to assign the current date + 7 days to the PEND_DT field in my Table. Maybe I'm using the wrong event?

Private Sub Form_Close()
Dim strHoldDate

'Returns current system date plus 7 days
If IsNull(txtPendDate) Then
strHoldDate = DateAdd("d", 7, Date)
Me![PEND_DT] = strHoldDate
End If

End Sub

Thanks!
Liz
 
This code in the FORMS Before Update event should work for you. It would also work in the On Exit event of the txtPendingDate field, but someone could mouse past it and not trigger the code.

If IsNull(Me![txtPendDate]) Then
Me![PEND_DT] = Date + 7
End If
 
It's working now. Thanks a lot!
I put the code in the After_Update event of another control on the form that is required. The Before_Update event of the FORM wasn't triggering. It's probably just the way that I have the form setup.
Thanks for your help.
-Liz
 

Users who are viewing this thread

Back
Top Bottom