Featured Replies
Archivado
Este tema está ahora archivado y está cerrado a más respuestas.
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Este tema está ahora archivado y está cerrado a más respuestas.
Buen dia Gente..
Alguna Sugerencia
ya que cuando selecciono una fila en excel doy clic en el boton "enviar datos"
los manda excelente.
pero suele pasar que por equivocacion vuelvamos a seleccionar esa fila y damos clic
y lo que quiero es que ya no los envia repetidos.
Espero su Aporte.
Anexo Codigo.
Private Sub CommandButton1_Click()
Dim sql As String
Dim cn As Object
Dim rst As Object
Dim PP As Long
rowCursor = Activecell.Row
sql = "Insert Into Reporte(Cliente, Dim, Tipo, Mate, NoRodillo, Cond, HoraCromado, RA, Picos, Temp, ReversaA, ReversaT, CromadoA, CromadoT, Volts, CondA, RAB, PicosA, Celda ) " & _
"VALUES ('" & Cells(rowCursor, 1) & "', '" & Cells(rowCursor, 2) & "', '" & Cells(rowCursor, 3) & "', '" & Cells(rowCursor, 4) & "', '" & Cells(rowCursor, 5) & "', '" & Cells(rowCursor, 6) & "', '" & Cells(rowCursor, 7) & "', '" & Cells(rowCursor, 8) & "', '" & Cells(rowCursor, 9) & "', '" & Cells(rowCursor, 10) & "', '" & Cells(rowCursor, 11) & "', '" & Cells(rowCursor, 12) & "', '" & Cells(rowCursor, 13) & "', '" & Cells(rowCursor, 14) & "', '" & Cells(rowCursor, 15) & "', '" & Cells(rowCursor, 16) & "', '" & Cells(rowCursor, 17) & "', '" & Cells(rowCursor, 18) & "', '" & Cells(rowCursor, 19) & " ')"
' crea un objeto Connection
Set cn = CreateObject("ADODB.Connection")
'cn.ConnectionString = "driver={SQL Server};server=ADM\SQLEXPRESS;database=Prueba"
cn.ConnectionString = "driver={SQL Server};server=ADM\SQLEXPRESS;uid=sa;pwd=adm;database=Prueba"
If sql <> vbNullString Then
' variable para al rec de ado
' abre la conexión a la base de datos
' On Error GoTo nohayinternet
cn.Open
' crea un nuevo objeto recordset
Set rst = CreateObject("ADODB.Recordset")
' Ejecuta el sql para llenar el recordset
rst.Open sql, cn, 1, 3
' variables para los indices de las filas y columnas
C = 0
F = 0
' recorre las columnas, añade el nombre del campo al encabezado
'ProgressBar1.
' cierra y descarga las referencias
On Error Resume Next
rst.Close
cn.Close
Set cn = Nothing
Set rst = Nothing
End If
MsgBox "Insertado en la Tabla", vbInformation, "Insertado"
'exito:
End Sub