I'm trying to save a record and set one of its values when that happens.
this is my code:
Private Sub SvProforma_Click()
On Error GoTo Err_SvProforma_Click
Dim strInput As String
Dim strSetTtl As String
Dim strTotal As String
Dim stLinkCriteria As String
stLinkCriteria = "[ProformaId] =" & Me![ProformaId]
strTotal = Me.TOTALctrl.Value
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
strSetTtl = "UPDATE Proformas " & _
"SET Proformas.[TOTAL] ='" & strTotal & "' " & _
"WHERE Proformas.[ProformaId]='" & strLinkCriteria & "' ;"
DoCmd.RunSQL strSetTtl
MsgBox "Record Saved"
Exit_SvProforma_Click:
Exit Sub
Err_SvProforma_Click:
MsgBox Err.Description
Resume Exit_SvProforma_Click
End Sub
It says that there is an error in the criteria. But both fields (the unbound field in the form and the field in the table) have the same value (€)
this is my code:
Private Sub SvProforma_Click()
On Error GoTo Err_SvProforma_Click
Dim strInput As String
Dim strSetTtl As String
Dim strTotal As String
Dim stLinkCriteria As String
stLinkCriteria = "[ProformaId] =" & Me![ProformaId]
strTotal = Me.TOTALctrl.Value
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
strSetTtl = "UPDATE Proformas " & _
"SET Proformas.[TOTAL] ='" & strTotal & "' " & _
"WHERE Proformas.[ProformaId]='" & strLinkCriteria & "' ;"
DoCmd.RunSQL strSetTtl
MsgBox "Record Saved"
Exit_SvProforma_Click:
Exit Sub
Err_SvProforma_Click:
MsgBox Err.Description
Resume Exit_SvProforma_Click
End Sub
It says that there is an error in the criteria. But both fields (the unbound field in the form and the field in the table) have the same value (€)