desjardins
Registered User.
- Local time
- Yesterday, 22:50
- Joined
- Dec 21, 2010
- Messages
- 13
I am trying to update a date field (enddate) in a table (tbl_employees) with the value of a text box (TerminationDate) in a form. The format of the text box is set to short date.
Private Sub TerminationDate_AfterUpdate()
Dim termdate As Date
termdate = Me.TerminationDate.Value
If Not IsNull(termdate) Then
DoCmd.RunSQL "UPDATE tbl_employees SET [enddate]=[termdate]" _
& " WHERE [tbl_employees].[PersonID]= me.personID;"
End If
End Sub
I get an "enter parameter value" msgbox for termdate. I have also tried "dim termdate as string".
If the table already has a date in it, I don't want to overwrite with a null value (hence the IF statement). The text box is already bound to another table (tbl_terminations), is this the problem? How do I get the one text box to update both tables?
Private Sub TerminationDate_AfterUpdate()
Dim termdate As Date
termdate = Me.TerminationDate.Value
If Not IsNull(termdate) Then
DoCmd.RunSQL "UPDATE tbl_employees SET [enddate]=[termdate]" _
& " WHERE [tbl_employees].[PersonID]= me.personID;"
End If
End Sub
I get an "enter parameter value" msgbox for termdate. I have also tried "dim termdate as string".
If the table already has a date in it, I don't want to overwrite with a null value (hence the IF statement). The text box is already bound to another table (tbl_terminations), is this the problem? How do I get the one text box to update both tables?