Hola a todos, tengo el siguiente código pero me sale error:
Código:
Dim SQL2 As Integer
Adodc3.CursorLocation = adUseClient
Adodc3.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\CONTROL ALMACEN.accdb;Persist Security Info=False"
Adodc3.RecordSource = "select SUM(Entrada-Salida)as SaldoInicial From Movimientos where CodProducto= '" & txtcodigo.Text & "' And (Fecha <= 01/01/2014) And (Fecha <= #" & Format(dtp1.Value, "mm/dd/yyyy") & "#)Group By CodProducto"
Adodc3.Refresh
SQL2 = Adodc3.Recordset.Fields(0)
txtsaldoinicial.Text = SQL2
el error sale en la línea en donde la variable SQL toma el valor de la consulta
Alguien podría ayudar. Gracias de antemano