Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Define/passing varibles in excel to Sql Query

  • 01-04-2008 10:49am
    #1
    Registered Users, Registered Users 2 Posts: 221 ✭✭


    Hi All,

    I'm pretty much totally new to excel . I'm working on a sheet, which needs to draw data from an sql server DB. I need to allow the user to enter a date into a field and use this in the query. I have a sample query in which I can see that in the query the variable is shown as '<variablename>' and in the sheet on another sheet theres "set variblename = " and a reference to the field where the user enters variable value.

    How do i define a variable like above so excel recognises what I’m passing

    Thanks in advance

    - Elfman


Comments

  • Registered Users, Registered Users 2 Posts: 901 ✭✭✭EL_Loco


    are you using VBA for this in a macro, or are you trying to use the datasource functions in the excel GUI?

    in VBA to get the value of a cell and assign it:
    dim sVar as string
    
    sVar = cells(1,1).value
    
    'where 1,1 is the co-ordinate of the cell. row, column
    
    

    this link may help also:

    http://www.oreilly.com/catalog/integratingea/chapter/ch03.pdf


  • Registered Users, Registered Users 2 Posts: 221 ✭✭Elfman


    Yeah I'm trying to avoid using vba if i can


  • Registered Users, Registered Users 2 Posts: 901 ✭✭✭EL_Loco


    just went to try a database query through the GUI and it's not installed. have to go find the disc. :( why does it do that, it's a real pain, I did a "full" install initially too.


Advertisement