Public Sub copiaintro()
Dim adapta2 As New OleDbDataAdapter
Dim datavacio As New DataSet
Try
'creo los parametros que uso en el SELECT, para filtrar en el datagridview(dgtotales)
Dim comados = conexion.CreateCommand
comados.CommandType = CommandType.Text
Dim comatres = conexion.CreateCommand
comatres.CommandType = CommandType.Text
Dim comacuatro = conexion.CreateCommand
comacuatro.CommandType = CommandType.Text
Dim comacinco = conexion.CreateCommand
comacinco.CommandType = CommandType.Text
comatres.CommandText = "INSERT INTO FechasFiltro SELECT Fecha FROM [Introducción De Ventas] WHERE Fecha BETWEEN @FI AND @FF Order by Fecha"
comatres.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
comatres.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))
comacuatro.CommandText = "INSERT INTO FechasFiltroFinal SELECT Fecha FROM FechasFiltro WHERE FechasFiltroFinal.Fecha <> FechasFiltro.Fecha group by Fecha"
comacuatro.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
comacuatro.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))
comacinco.CommandText = "Delete From FechasFiltro"
comacinco.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
comacinco.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))
comados.CommandText = "INSERT INTO IntroduccionDeVentasAhora SELECT * FROM [Introducción De Ventas] WHERE Fecha BETWEEN @FI AND @FF order by Fecha"
comados.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
comados.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))
conexion.Open()
Dim lecto2 = comatres.ExecuteNonQuery
Dim lecto4 = comacuatro.ExecuteNonQuery
If lecto4 = comacuatro.ExecuteNonQuery Then
Else
End If
Dim Lecto1 = comados.ExecuteNonQuery
Dim lecto6 = comacinco.ExecuteNonQuery
Dim lecto5 = comacinco.ExecuteNonQuery
Catch
cargacomboMostradores()
cargacomboTerminales()
'cargacombos()
MessageBox.Show("Se han copiado los datos seleccionados entre fechas " + Fecha1.Value.Date.ToString("dd/MM/yyyy") + " y " + Fecha2.Value.Date.ToString("dd/MM/yyyy"), "")
'LbFechaPrimera.Visible = True
cargafechaslabelprimera1()
'LbFechasultima.Visible = True
cargafechaslabelultima1()
'Lhasta.Visible = True
conexion.Close()
'Catch
End Try
'BPasa.Enabled = False
End Sub
![Negando](http://static.forosdelweb.com/fdwtheme/images/smilies/negar.gif)