On event "key press" I want to check that in my field "tblZlecenia.priorytet" there is value "7", if yes then Exit sub.
I know how to create query to get results with all rows with "7" in my table, but I don't know how to get it in event using vba.
My code:
I know how to create query to get results with all rows with "7" in my table, but I don't know how to get it in event using vba.
My code:
Code:
Private Sub Lista0_KeyPress(KeyAscii As Integer)
Dim strSQL As String
Dim db As DAO.Database
If KeyAscii = 50 Then
strSQL = "UPDATE tblZlecenia SET Priorytet = " & "7" & " WHERE ID_Zlecenia='" & Me.Lista0 & "'"
CurrentDb.Execute strSQL
KeyAscii=0
End If
End Sub