MarkItZero
Active member
Hello,
I am trying to update a Date field in an Access database by reading the value from a text box on my form. The user enters the value on the form and clicks the Update button.
However when I attempt to run the program, I get an error after clicking the Update button that says Type Mismatch.
So I am guessing that this means I need to perform some sort of datatype conversion before attempting the update.
Rst1 is my Recordset
DateUpdate is a variable I use to hold the text boxs value
txtDate is the Text box containing the value to be updated
Here is the code I have so far...
Any suggestions?
Thanks!
I am trying to update a Date field in an Access database by reading the value from a text box on my form. The user enters the value on the form and clicks the Update button.
However when I attempt to run the program, I get an error after clicking the Update button that says Type Mismatch.
So I am guessing that this means I need to perform some sort of datatype conversion before attempting the update.
Rst1 is my Recordset
DateUpdate is a variable I use to hold the text boxs value
txtDate is the Text box containing the value to be updated
Here is the code I have so far...
Code:
Load Current Date Value
txtDate.Text = CStr(rst1("Date").Value)
Set New Value to DateUpdate Variable
DateUpdate = txtDate.Text
Private Sub CmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdBack.Click
rst1.Fields("Date").Value = " & DateUpdate & "
rst1.Update()
End Sub
Any suggestions?
Thanks!