Hi, i have a problem qith access 2007... the code works but it adds one extra row to the table dont know why...
For example if num20 is "4" the code inserts 5 rows.. but in the 1st one the field "Tarifa" is empty. Tarifa is the only field that im passing a string instead of a parameter from the form...
If num20 is 0 or negative it inserts 1 row with "Tarifa" empty ,could someone explain me why? thx
Edit: If i remove everything! except the insert into it stills inserting 2 rows, and one with "tarifa" empty, whyyyyyyyy? :s like
Code:
Private Sub Guardar_Click()
Dim num20 As Integer
num20 = Me.Testo33
For i = 1 To num20
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Contratos ([Nombre Agente],[Nombre Cliente],DNI,[Nombre Empresa],CIF,[Telefono Fijo 1], [Telefono Fijo 2], [Telefono Movil], Tarifa, [Fecha WE Entrega], [Fecha WE Pago], [Fecha Daily]) VALUES ('" & Me.Nombre_Agente & "','" & Me.Nombre_Cliente & "','" & Me.DNI & "','" & Me.Nombre_Empresa & "','" & Me.CIF & "','" & Me.Telefono_Fijo_1 & "','" & Me.Telefono_Fijo_2 & "','" & Me.Telefono_Movil & "','2.0','" & Me.Fecha_WE_Entrega & "','" & Me.Fecha_WE_Pago & "','" & Me.Fecha_Daily & "')"
DoCmd.SetWarnings True
Next i
Me.Requery
End Sub
For example if num20 is "4" the code inserts 5 rows.. but in the 1st one the field "Tarifa" is empty. Tarifa is the only field that im passing a string instead of a parameter from the form...
If num20 is 0 or negative it inserts 1 row with "Tarifa" empty ,could someone explain me why? thx
Edit: If i remove everything! except the insert into it stills inserting 2 rows, and one with "tarifa" empty, whyyyyyyyy? :s like
Code:
Private Sub Guardar_Click()
DoCmd.RunSQL "INSERT INTO Contratos ([Nombre Agente],[Nombre Cliente],DNI,[Nombre Empresa],CIF,[Telefono Fijo 1], [Telefono Fijo 2], [Telefono Movil], Tarifa, [Fecha WE Entrega], [Fecha WE Pago], [Fecha Daily]) VALUES ('" & Me.Nombre_Agente & "','" & Me.Nombre_Cliente & "','" & Me.DNI & "','" & Me.Nombre_Empresa & "','" & Me.CIF & "','" & Me.Telefono_Fijo_1 & "','" & Me.Telefono_Fijo_2 & "','" & Me.Telefono_Movil & "','2.0','" & Me.Fecha_WE_Entrega & "','" & Me.Fecha_WE_Pago & "','" & Me.Fecha_Daily & "')"
End Sub
Last edited: