insert sql result into variable in vba Excel

  • Hi all,


    My need is to insert sql result into variable in vba Excel.
    Here is my code:





    The execution interrupts at line "objADO.Execute strSQL" with error message:


    Run-time error '-2147217900 (80040e14)':
    [Microsoft][ODBC driver for Oracle][Oracle]ORA-00905: missing keyword


    What I'm missing?


    Another question is how do I tune "Prompt" property in order to ask username and password only once (do not repeat prompt untill user closes Excel).


    Thanks ahead.

  • Re: insert sql result into variable in vba Excel


    My problem is solved, I've got sql result into variable.
    I still need to tune "Prompt" property in order to ask username and password only once (do not repeat prompt untill user closes Excel).


  • Re: insert sql result into variable in vba Excel


    Please edit your posts to include code tags rather than quote tags around your code listings - code tags are required by the rules you agreed to when you joined the forum.


    You can add code tags by replacing the quote tags ([noparse]

    Quote

    [/noparse]

    Quote

    & [noparse]

    [/noparse]) with [noparse]

    Code
    [/noparse][/b] & [b][noparse]

    [/noparse][/b]...

  • Re: insert sql result into variable in vba Excel


    Quote from cytop;580161

    Please edit your posts to include code tags rather than quote tags around your code listings - code tags are required by the rules you agreed to when you joined the forum.


    You can add code tags by replacing the quote tags () with [noparse]

    Code
    [/noparse][/B] & [B][noparse]

    [/noparse][/B]...


    I've edited my posts. Hope it's ok now.

  • Re: insert sql result into variable in vba Excel


    You can use an InputBox for the password to store this as a variable to be used in the connection string. Also you're better off using the Oracle Provider instead of the Microsoft one.


    HTH


    C

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!