J
Joel
I have a table with a few test records in it. Second, I have form
where I am passing data for the LvUserName (unbound text field)
information from a previous form and I
am capturing the current date (Date()) in another unbound text field.
Third,
I am trying to find the record in the table that matches these two
fields using a (WHERE) search criteria and post the next three (3)
fields as an update. The process
is posting the three fields but to the first record in the table and it
should be posting to the third record where the table fields match the
WHERE fields. Can anyone help me with this?
Private Sub SaveLvRec_Click()
On Error GoTo Err_SaveLvRec_Click
QrySQL = "UPDATE Timesheet" _
& " SET Timesheet.LvType = '" & Forms!frmLvTimeCard!LvTypeCbo & "'"
_
& " Timesheet.LvStart = #" & Forms!frmLvTimeCard!TxtLvStart & "#" _
& " Timesheet.LvHours = " & Forms!frmLvTimeCard!TxtLvHours _
& " WHERE Timesheet.UserName = '" & Forms!frmLvTimeCard!LvUserName
& "'" _
& " AND Timesheet.TDate = #" & Forms!frmLvTimeCard!TxtLvDate & "#;"
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.Close
DoCmd.OpenForm "frmLogon"
DoCmd.SetWarnings True
Exit_SaveLvRec_Click:
Exit Sub
Err_SaveLvRec_Click:
MsgBox Err.Description
Resume Exit_SaveLvRec_Click
End Sub
where I am passing data for the LvUserName (unbound text field)
information from a previous form and I
am capturing the current date (Date()) in another unbound text field.
Third,
I am trying to find the record in the table that matches these two
fields using a (WHERE) search criteria and post the next three (3)
fields as an update. The process
is posting the three fields but to the first record in the table and it
should be posting to the third record where the table fields match the
WHERE fields. Can anyone help me with this?
Private Sub SaveLvRec_Click()
On Error GoTo Err_SaveLvRec_Click
QrySQL = "UPDATE Timesheet" _
& " SET Timesheet.LvType = '" & Forms!frmLvTimeCard!LvTypeCbo & "'"
_
& " Timesheet.LvStart = #" & Forms!frmLvTimeCard!TxtLvStart & "#" _
& " Timesheet.LvHours = " & Forms!frmLvTimeCard!TxtLvHours _
& " WHERE Timesheet.UserName = '" & Forms!frmLvTimeCard!LvUserName
& "'" _
& " AND Timesheet.TDate = #" & Forms!frmLvTimeCard!TxtLvDate & "#;"
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.Close
DoCmd.OpenForm "frmLogon"
DoCmd.SetWarnings True
Exit_SaveLvRec_Click:
Exit Sub
Err_SaveLvRec_Click:
MsgBox Err.Description
Resume Exit_SaveLvRec_Click
End Sub