Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Query Editor acting weird

Status
Not open for further replies.

SweetDot

Technical User
Jan 19, 2004
65
US
Hi all,
I've been having problems with a simple excel query. What I want to do is to have this query done on an external data:

SELECT TSC_Change_Request_v2.Status, TSC_Change_Request_v2.CR_ID, TSC_Change_Request_v2.Objective, TSC_Change_Request_v2.Planned_Start_Date__mm_dd_yy_, TSC_Change_Request_v2.Planned_Start_Time__hh_mm_, TSC_Change_Request_v2.Planned_End_Time__date_, TSC_Change_Request_v2.Planned_Duration__dd_hh_mm_, TSC_Change_Request_v2.Actual_Duration__dd_hh_mm_, TSC_Change_Request_v2.Requester_Name
FROM TSC_Change_Request_v2 TSC_Change_Request_v2
WHERE (TSC_Change_Request_v2.Requester_Name = 'DAN') OR (TSC_Change_Request_v2.Requester_Name Like 'ANDREW') AND (TSC_Change_Request_v2.Planned_Start_Date__mm_dd_yy_>=[Report start date])

----[Report start date] is supposed to be a parameter that needs to be entered everytime the query is executed.

but everytime when i try to run the query, excel would automatically change my query, and it then looks like this:

SELECT TSC_Change_Request_v2.Status, TSC_Change_Request_v2.CR_ID, TSC_Change_Request_v2.Objective, TSC_Change_Request_v2.Planned_Start_Date__mm_dd_yy_, TSC_Change_Request_v2.Planned_Start_Time__hh_mm_, TSC_Change_Request_v2.Planned_End_Time__date_, TSC_Change_Request_v2.Planned_Duration__dd_hh_mm_, TSC_Change_Request_v2.Actual_Duration__dd_hh_mm_, TSC_Change_Request_v2.Requester_Name
FROM TSC_Change_Request_v2 TSC_Change_Request_v2
WHERE (TSC_Change_Request_v2.Requester_Name Like 'DEJESUS%') AND (TSC_Change_Request_v2.Planned_Start_Date__mm_dd_yy_>=?) OR (TSC_Change_Request_v2.Requester_Name Like 'LUK A%') AND (TSC_Change_Request_v2.Planned_Start_Date__mm_dd_yy_>=?)

which is not what i want at all!!!!
I can't figure out why excel just changes my query into something that's not even close to what I wanted. I'm using excel 97. Is that a limitation of excel 97?
I'm using an external data source called Action Request System.
Can anyone please help?

thanks very much
Hillary
 
Hi,

Are you using a Saved Query?

I never "Save" the query as a .qry file. If you do not save the query, it's still there in THAT workbook/Worksheet/QueryTable and it can be edited.

I'd recreate the query using the SQL that you want, without saving the query. I see no other reason why your parameter query should not work EXACTLY as you have written it.

Skip,
[sub]
[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue][/sub]
 
Hi Skip,
I did try to edit the query without saving, but everytime I hit the exclamation mark to run the query, and I go back to the SQL query window, the query would be changed. And as you can see in the query I pasted in (the 2nd part), the parameter date value that I entered would be "?". I have no idea why it would behave this way.
 
Apparently, MS Query DOES replace the brackets etc with ? in the sql. But the PROMPT is still there, is it not?

I do not know, however, why the other LITERALS would change in the sql.

Skip,
[sub]
[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top