Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Incorrect syntax near '#' problem when returning to MS Query fromExcel

Hi

I'm having a strange problem when some of our users are running queries
from Excel. They create the query in MS Query using the GUI - select
tables etc. and then enter their criterias. They can run the query and
return the results to Excel - no problem.
When they then want to edit the query, and in Excel choose "Edit
database query" (I'm not sure what the correct naming for this is since
I've only got a Danish Excel at hand..) they get back to MS Query and
then they get this error message :

Incorrect syntax near '#'
The statement could not be prepared

I think I've narrowed the error down to being a date range selection
containing an AND that are causing the problem.

When I look at how the query looks as a SQL statement - before returning
data to Excel, it looks like this :

SELECT .....FROM MYTable WHERE....((BudgetPos.BogforingsDato{ts
'2005-06-30 00:00:00'} And BudgetPos.BogforingsDato<{ts '2006-01-01
00:00:00'})......

This looks ok and it also works as expected. If I then look at the same
query after returning to MS Query (where they get the syntax error), it
looks like this :

SELECT .....FROM MyTable WHERE...((BudgetPos.BogforingsDato#30-06-2005#
Og <#01-01-2006#)) ....

As you can see, it has now changed the AND to an "OG" (which is AND in
Danish) and it has put the # around the dates instead of {ts.... We
filter on other fields in the query and between the various fileds, it
shows AND as it should and doesn't "translate" to "Og". In other words
it seems like the problem is only with the daterange in one field.

To me it looks like the date criteria now looks excatly like how it's
being entered in the "criteria box" in the GUI in MS Query.

When I run the same selection in my own Excel, it works fine - same
saved selection etc. works without any problems.
When I look at the SQL query after returning from Excel it looks the
same as before so for me everything works as expected.

We are running Excel in Citrix, and I run it off the same servers as the
regular users, so it's the same Excel/MS Query installation.

I've looked high and low to try to find out why we see this problem, but
I simply can't find any reason.

Regards
Steen

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
subtraction returning incorrect calue Ashish_Vaidya Excel Worksheet Functions 5 March 19th 10 12:40 AM
Lookup returning incorrect value Sherry Excel Discussion (Misc queries) 3 January 29th 08 07:57 PM
IF function returning incorrect result Hillary E. Excel Worksheet Functions 2 August 22nd 06 05:43 PM
formula returning incorrect blanks [email protected] Excel Discussion (Misc queries) 7 March 9th 06 07:15 PM
Incorrect syntax near '#' problem when returning to MS Query fromExcel Steen Persson (DK) Excel Discussion (Misc queries) 0 March 7th 06 03:23 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"