Date: prev next · Thread: first prev next last


Buen dia mi nombre es Lucas,

Me encuentro con un problema de ni poder resolver una macro para acceder a
informacion de mi base de datos.
Mi idea es seleccionar una celda (A13) y si coincide dicho valor con la
informacion de mi base de datos, exportar la informacion en otra celda
(D13).
Y asi poder hacerlo con los valores que coloque debajo de la fila A13.

Dejo el codigo, muchas gracias. Que tengan un buen dia,


Sub Contador_Kg()
Dim oHojaActiva As Object
Dim sBaseDatos As String
Dim sSQL As String
Dim sTabla As String
Dim i As String
Dim oSel As Object

Dim mOpcBD(2) As New "com.sun.star.beans.PropertyValue"

sBaseDatos = "Materiales"
sTabla = "Materiales_Promocion"

oHojaActiva = ThisComponent.getCurrentController.getActiveSheet()
ThisComponent.CurrentController.select
<http://thiscomponent.currentcontroller.select/>("A13:A20")

oSel = ThisComponent.getCurrentSelection()
If oSel.getImplementationName() = "ScCellObj" Then

sSQL = "SELECT * FROM Materiales_Promocion WHERE ""Código QM"" ='" & oSel &
"'"

mOpcBD(0).Name = "DatabaseName"
mOpcBD(0).Value = sBaseDatos
mOpcBD(1).Name = "SourceType"
mOpcBD(1).Value = com.sun.star.sheet.DataImportMode.SQL
mOpcBD(2).Name = "SourceObject"
mOpcBD(2).Value = sSQL

oHojaActiva.getCellRangeByName("D12:D20").doImport( mOpcBD() )
End If

End Sub

-- 
Para instrucciones sobre darse de baja envíe un mensaje a: users+unsubscribe@es.libreoffice.org
¿Problemas? https://es.libreoffice.org/recibe-ayuda/listas-de-correo/baja/
Guías para envío + más: https://wiki.documentfoundation.org/Netiquette/es
Archivo de la lista: https://listarchives.libreoffice.org/es/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.