473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.CDClientName
, CltDue.CDEventDesc
, CltDue.CDDescription
, (empfname)+' '+(emplname)
, CltDue.CDTargetAmount
, CltDue.CDTargetHours
FROM VPM.dbo.CltDue CltDue, VPM.dbo.Employee Employee
WHERE CltDue.CDInCharge = Employee.ID
AND ((CltDue.CDStart 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,CDdateComplete, 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.
Oct 19 '07 #1
2 2243
Jim Doherty
897 Expert 512MB
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.CDClientName
, CltDue.CDEventDesc
, CltDue.CDDescription
, (empfname)+' '+(emplname)
, CltDue.CDTargetAmount
, CltDue.CDTargetHours
FROM VPM.dbo.CltDue CltDue, VPM.dbo.Employee Employee
WHERE CltDue.CDInCharge = Employee.ID
AND ((CltDue.CDStart 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,CDdateComplete, 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 :)
Oct 21 '07 #2
Thanks, I'll give it a try
Oct 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joe Gazda | last post by:
I'm a relative newbie to PHP, but have been able to put together some PHP code to generate a CSV/XLS file from a Query result. Now, I would like to include custom column names instead of the MySQL...
1
by: mike | last post by:
Ok, I have a page that queries a database and retrieves values to create a custom report in ms excel format on the fly so that it can be downloaded. I can use the following sub to generate the...
3
by: Andrew | last post by:
With command-line interface ( 3.23.37, UNIX Socket ) all is well with column aliasing. However, column aliases disappear in Excel, over ODBC, when there are multiple (joined) tables in the query. ...
10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
4
by: pw | last post by:
Hi, I have month names (coming from a field in a table) as the column heading in an Access 97 crosstab query. It is being sorted alphabetically. This will not do. The only way that I know to...
1
by: Steve | last post by:
I have looked through the newsgroup for an answer to this but haven't been able to find anything resembling my situation. What I want to do is relatively simple, I think. I have a crosstab...
3
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
5
by: Hokiecow | last post by:
I'm trying to import specific columns from an excel file (Requirements.xls) into an access table (tblRequirements). Using VBA, I'm able to import the entire excel file into table...
0
by: troy_lee | last post by:
I have a report based on a query. It is a simple listing of returned merchandise that has been repaired and shipped. I have a text box in the detail section that calculates the total days the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.