Question

classic Classic list List threaded Threaded
2 messages Options
Yohann Valette Yohann Valette
Reply | Threaded
Open this post in threaded view
|

Question

Hello,
I have a problem with Base, I created a macro but, if the file location
changes, the macro doesn't work, I wanted to know how to fix this problem
if possible..

I join you my macro:
Sub CambiarNombreEstanteria
        Dim oDBContext As Object , oDB As Object , oBase As Object
        Dim oStatement As Object , oRequete As Object
        Dim strSQL As String

        'On se connecte à la base de données référencées
        oDBContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
        oDB = oDBContext.getbyName("DocProyectosV1")

        'La base est sans login/password
        oBase = oDB.getConnection("","")

        'On prépare la requête
        oStatement = oBase.createStatement()

        'On saisit la requête que l'on stocke dans la chaine strSQL
        'A noter, chaque " doit être doublé et la requête SQL doit être
entre ".
        Dim a as String, b as string
        b= InputBox ("Apunta el nombre de la estanteria que quieres
renomar","Nombre actual de la estanteria")
        a= InputBox ("Apunta el nuevo nombre de la estanteria","Nuevo
nombre de la estanteria")
        strSQL= "UPDATE ""Documento"" SET ""Estanteria"" ="+a+" WHERE
""Estanteria""="+b

        'On exécute la requête SQL
        oRequete = oStatement.executeQuery( strSQL )
        'On ferme proprement les appels
        oRequete.Close
        oStatement.Close
        oBase.Close
        oBase.Dispose
  End Sub

Thanks for your help,
Have a good day!

--
To unsubscribe e-mail to: [hidden email]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/website/
All messages sent to this list will be publicly archived and cannot be deleted
Jean-Baptiste Faure Jean-Baptiste Faure
Reply | Threaded
Open this post in threaded view
|

Re: Question

Hi,

Le 04/08/2014 10:19, Yohann Valette a écrit :
> Hello,
> I have a problem with Base, I created a macro but, if the file location
> changes, the macro doesn't work, I wanted to know how to fix this problem
> if possible..

You are in the wrong mailing-list. Please ask on
[hidden email] or on AskLibo : http:\\ask.libreoffice.org

Best regards.
JBF

--
Seuls des formats ouverts peuvent assurer la pérennité de vos documents.

--
To unsubscribe e-mail to: [hidden email]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/website/
All messages sent to this list will be publicly archived and cannot be deleted