I have what seems like a very simple forumla that I can't get to work. In a multi-tab form two of my fields are TypeofInvestigation which is a combo box and CaseFileClosed which is a Yes/No box. All I want is when the phrase "Close" is somewhere in the TypeofInvestigation that the CaseFileClosed is changed to Yes. I have placed the following code in the TypeofInvestigation OnLostFocus event. I have just been trying to figure out how to do a specific combo box choice of "Opening/Closing" before trying to figure out how to get all of them to respond. I keep getting the "Didn't update... 1 record due to lock violations" error. Even stranger, the very first time I go into the database it seems to work, once.
Any help would be appreciated.
Private Sub Text87_LostFocus()
If Me![TypeofInvestigation] = "Opening/Closing" Then
DoCmd.OpenQuery "queCloseCase"
End If
End Sub
The SQL view of that query is
UPDATE [Case Files] SET [Case Files].CaseFileClosed = 1
WHERE ((([Case Files].[Case File Number])=[Forms]![frmEditInvestigationInformation]![CaseFileNumber]));
I also tried to use the DoCmd.RunSQL with the code directly with the same results.
I could not find a similar answer in my search of the TekTips forum.
Any help would be appreciated.
Private Sub Text87_LostFocus()
If Me![TypeofInvestigation] = "Opening/Closing" Then
DoCmd.OpenQuery "queCloseCase"
End If
End Sub
The SQL view of that query is
UPDATE [Case Files] SET [Case Files].CaseFileClosed = 1
WHERE ((([Case Files].[Case File Number])=[Forms]![frmEditInvestigationInformation]![CaseFileNumber]));
I also tried to use the DoCmd.RunSQL with the code directly with the same results.
I could not find a similar answer in my search of the TekTips forum.