473,326 Members | 2,126 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,326 software developers and data experts.

Run-time error '3075': Extra ) in query expression...

Please see code below:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT Max(EntryType) AS MaxOfEntryType " & _
  2. "FROM tblForecastData GROUP BY BusinessLine, [Packaging Location], Week " & _
  3. "HAVING ((([Packaging Location])='" & xx & "') AND ((Week)=" & xx & ")) "
I don't understand why I am receiving the following error:

Run-time error '3075':

Extra ) in query expression '((([Packaging Location])=") AND
((Week)=))'.

If I remove the ('s I receive an error stating that there are (operators missing). Is there anything obviously wrong someone would please point out to me?

Thank you,

Nadnerb
Jun 18 '07 #1
6 5400
Please see code below:

strSQL = "SELECT Max(EntryType) AS MaxOfEntryType " & _
"FROM tblForecastData GROUP BY BusinessLine, [Packaging Location], Week " & _
"HAVING ((([Packaging Location])='" & xx & "') AND ((Week)=" & xx & ")) "

I don't understand why I am receiving the following error:

Run-time error '3075':

Extra ) in query expression '((([Packaging Location])=") AND
((Week)=))'.

If I remove the ('s I receive an error stating that there are (operators missing). Is there anything obviously wrong someone would please point out to me?

Thank you,

Nadnerb
\

In the example you gave, you put single quote ' ' around xx for Packaging Location but not for Week.
Jun 18 '07 #2
I did that intentionally because the field Week is a number data type; is that the incorrect way to handle that?

When I add the single quotes around Week I receive a data type mismatch error.
Jun 18 '07 #3
Killer42
8,435 Expert 8TB
You're correct, for a numeric field you don't use quotes. mtaylor314 just didn't realise it was numeric.

I would definitely remove some of the parentheses - there are 'way too many. This is probably the fault of Access, which throws them in everywhere it can possibly find an excuse. Let's try to trim it down a bit...

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT Max(EntryType) AS MaxOfEntryType " & _
  2. "FROM tblForecastData GROUP BY BusinessLine, [Packaging Location], Week " & _
  3. "HAVING [Packaging Location] = '" & xx & "' AND Week = " & xx
By the way, I assume xx is just a placeholder here, and not your actual variable name?

One other thing - I could be completely wrong on this, but I think that a WHERE clause would be more efficient than a HAVING clause, in this case. Someone who is more on the ball with SQL could verify or refute that.
Jun 19 '07 #4
Killer42
8,435 Expert 8TB
P.S. You reported this Extra ) in query expression '((([Packaging Location])=") AND ((Week)=))'. In this case, it looks as though xx was empty, resulting in what does look like invalid SQL. For example, I'd guess that even if the extra parentheses all over the place are ok, ((Week)=)) should be ((Week)=0)).
Jun 19 '07 #5
Thank you both very much for your replies.

Here is what I've come up with using your input:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT Max(EntryType) AS MaxOfEntryType " & 
  2. "FROM tblForecastData GROUP BY BusinessLine, [Packaging Location], Week " & _
  3. "WHERE [Packaging Location]='" & 8150 & "'AND Week=" & 1
In the WHERE clause 8150 (text data type) and 1 (number data type) are my test values.

I now receive the following error message when running the procedure:

Run-time error '3075':

Syntax error (missing operator) in query expression 'Week WHERE [Packaging Location]='8150'AND Week=1'.


Any suggestions?
Jun 19 '07 #6
Killer42
8,435 Expert 8TB
I now receive the following error message when running the procedure:

Run-time error '3075':

Syntax error (missing operator) in query expression 'Week WHERE [Packaging Location]='8150'AND Week=1'.
Perhaps the missing space after '8150' is upsetting it?
Jun 20 '07 #7

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

Similar topics

3
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run...
4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
2
by: Jenna Olson | last post by:
Hi all- I've never seen this particular issue addressed, but was wondering if there's anything to support one way or another. Say I have a class: class ManipulateData { public:...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
19
by: Bryan | last post by:
How can i run a bit of code straight from the IDE? Right now i make a temporary button and put the code behind that, then i run debug mode and click on the button. Is there a way to highlight...
9
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
7
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.