I have used a panel to capture additional data for my table and need to update the record.
Sub WriteRecord
Purpose = edittext1.Text
Expenses = edittext4.Text
Destination = edittext2.text
Comments = edittext3.Text
recordstr = "UPDATE schedule SET "
recordstr = recordstr & " Expenses = " & Expenses
recordstr = recordstr & ", Destination = " & Destination
recordstr = recordstr & ", Purpose = " & Purpose
recordstr = recordstr & ", Comments = " & Comments
recordstr = recordstr & " where "
recordstr = recordstr & "StartDate = " & nStartDate & " and "
recordstr = recordstr & "StartTime = " & nStartTime
'Msgbox(recordstr,"Record layout")
Try
SQL1.ExecNonQuery(recordstr)
Catch
Msgbox(recordstr,"failed to find and update record")
End Try
End Sub
all I get is the Msgbox and the record not being updated. The records are unique in that the StartDate and Time together can only ever occur once.
Can anyone explain why it is not updating - I suspect my code is suspect?
Thank you in advance for your perusal and assistance
Sub WriteRecord
Purpose = edittext1.Text
Expenses = edittext4.Text
Destination = edittext2.text
Comments = edittext3.Text
recordstr = "UPDATE schedule SET "
recordstr = recordstr & " Expenses = " & Expenses
recordstr = recordstr & ", Destination = " & Destination
recordstr = recordstr & ", Purpose = " & Purpose
recordstr = recordstr & ", Comments = " & Comments
recordstr = recordstr & " where "
recordstr = recordstr & "StartDate = " & nStartDate & " and "
recordstr = recordstr & "StartTime = " & nStartTime
'Msgbox(recordstr,"Record layout")
Try
SQL1.ExecNonQuery(recordstr)
Catch
Msgbox(recordstr,"failed to find and update record")
End Try
End Sub
all I get is the Msgbox and the record not being updated. The records are unique in that the StartDate and Time together can only ever occur once.
Can anyone explain why it is not updating - I suspect my code is suspect?
Thank you in advance for your perusal and assistance