Can someone please take a look at my code below and tell me what I'm missing, and also that my SQL statement for finding and updating the record is correct.
ElseIf radOut.Checked = True Then 'SQL Query to retrieve the signer's last record Dim myConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='D:\Documents and Settings\PC\My Documents\Visual Studio 2005\Projects\Register v7.0\Register v7.0\Reg v2.mdb'") Dim SQLQuery As String = "UPDATE Time MAX(EntryID) SET TimeOut = " & TimeString & " and SignatureOutData = " & SigString & " WHERE FirstName = " & cmbName.Text & " and TimeOut = NULL" MessageBox.Show(SQLQuery) Dim SignOut As New OleDbCommand(SQLQuery, myConnection) Me.TimeTableAdapter1.Update(Reg_v2DataSet.Time) 'Confirms save MessageBox.Show("Saved!") 'saves final information to database Reg_v2DataSet.AcceptChanges()
The line "MessageBox.Show(SQLQuery)" gives the correct information for the variables used, but I'm not entirely sure about the SQL query's format.
Thanks for taking a look guys.