Column or Field variable for an Excel query.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • silversubey
    New Member
    • May 2007
    • 22

    Column or Field variable for an Excel query.

    Hello all.
    I have an excel query that pulls data from a SQL database. I have 2 parameters that represent the [start] and [end] of a between criteria. Here is the query.

    SELECT CltDue.CDClient Name
    , CltDue.CDEventD esc
    , CltDue.CDDescri ption
    , (empfname)+' '+(emplname)
    , CltDue.CDTarget Amount
    , CltDue.CDTarget Hours
    FROM VPM.dbo.CltDue CltDue, VPM.dbo.Employe e Employee
    WHERE CltDue.CDInChar ge = Employee.ID
    AND ((CltDue.CDStar t Between ? And ?))

    This works fine, but what i wish to do is create a 3rd parameter for CltDue.CDStart
    There are 4 fields in the CltDue table that i need.CDstart,CD dateComplete, CDTarget, and CDDateDelivered .
    I want the user to be able to choose one of these 4 from a list box and then enter the beginning and end date.
    Is excel capable of this?
    Thanks for any help.
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by silversubey
    Hello all.
    I have an excel query that pulls data from a SQL database. I have 2 parameters that represent the [start] and [end] of a between criteria. Here is the query.

    SELECT CltDue.CDClient Name
    , CltDue.CDEventD esc
    , CltDue.CDDescri ption
    , (empfname)+' '+(emplname)
    , CltDue.CDTarget Amount
    , CltDue.CDTarget Hours
    FROM VPM.dbo.CltDue CltDue, VPM.dbo.Employe e Employee
    WHERE CltDue.CDInChar ge = Employee.ID
    AND ((CltDue.CDStar t Between ? And ?))

    This works fine, but what i wish to do is create a 3rd parameter for CltDue.CDStart
    There are 4 fields in the CltDue table that i need.CDstart,CD dateComplete, CDTarget, and CDDateDelivered .
    I want the user to be able to choose one of these 4 from a list box and then enter the beginning and end date.
    Is excel capable of this?
    Thanks for any help.

    As with any of the VBA applications excel included you should be able to create either an dynamic SQL statement including your column values from a selectable list and then fire the SQL to the SQL server to retrieve your dataset or even better reference an stored procedure either way.....you are in the SQL Server forum so maybe you are better served in an Excel forum to follow through on the VBA application side of it?

    Regards

    Jim :)

    Comment

    • silversubey
      New Member
      • May 2007
      • 22

      #3
      Thanks, I'll give it a try

      Comment

      Working...