Welcome to the forum.
You have a few issues in your code. By the way, you should enclose the code in code tags, (click the # button in the reply menu)
Code:
Private Sub Real_Start_cinnosti_DblClick(Cancel As Integer)
Dim strSQL1 As String
Dim strSQL2 As String
Dim a, b, c, d As String ' <<--Issue 1
DoCmd.SetWarnings False
a = Me.Zakazka
b = Me.SS_Baugruppe
c = Date ' <<-- Issue 2
'd = "R"
If IsNull(Me.Real_Start_cinnosti) Then 'pokial uz existuje zaznam nespravi nic
'I changed how the query is constructed
strSQL1 = "INSERT INTO T_Hlavne_vypinace_change ( Zakazka, SS_Baugruppe, Real_Start_cinnosti )"
strSQL1 = strSQL1 & " SELECT T_Hlavne_vypinace.Zakazka, T_Hlavne_vypinace.SS_Baugruppe, T_Hlavne_vypinace.Real_Start_cinnosti"
strSQL1 = strSQL1 & " FROM T_Hlavne_vypinace"
strSQL1 = strSQL1 & " WHERE (((T_Hlavne_vypinace.Zakazka)= '" & a & "')and((T_Hlavne_vypinace.SS_Baugruppe)= '" & b & "'));"
Debug.Print strSQL1 '<<-- I added this line for debugging. Comment out when debugging is complete.
'CurrentDb.Execute strSQL1, dbFailOnError Or dbSeeChanges ' <<-- Issue 3
DoCmd.RunSQL strSQL1
'I changed how the query is constructed
strSQL2 = "UPDATE T_Hlavne_vypinace_Change"
strSQL2 = strSQL1 & " SET Real_Start_cinnosti= '" & c & "'" ' <<-- Issue 4
strSQL2 = strSQL1 & " WHERE Zakazka= '" & a & "' and SS_Baugruppe= '" & b & "';"
Debug.Print strSQL1 '<<-- I added this line for debugging. Comment out when debugging is complete.
DoCmd.RunSQL strSQL2
Else '<<-- not needed - no FALSE option
End If
DoCmd.SetWarnings True
DoCmd.Requery D_Show_Hlavne_vypinace_plan_and_status_podformular
End Sub
Issue 1 : If you use a statement like
Code:
Dim a, b, c, d As String
d is declared as type string
a, b. & c are declared as Variants
Variable types MUST be explicitly declared (Dim)
Code:
Dim a As String
Dim b As String
Dim c As Date
Dim d As String
================================================== ================
Issue 2: Do you really want to assign a Date to a string Variable?? Maybe the statement should be ================================================== ================
Issue 3: Instead of
Code:
CurrentDb.Execute strSQL1, dbFailOnError Or dbSeeChanges
try
Code:
CurrentDb.Execute strSQL1, dbFailOnError + dbSeeChanges
================================================== ================
Issue 4:
Code:
SET Real_Start_cinnosti= '" & c & "'"
Dates MUST be delimited with hashes (#)
Code:
SET Real_Start_cinnosti= #" & c & "#"
I ALWAYS use EXECUTE, Never RunSQL