473,626 Members | 3,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Works, but ASP gives me an error

39 New Member
Hello, I've been working on this for days and have been able to find anything to help me solve the problem. Here is my SQL query.

Select FISCALMONTH.id, FISCALMONTH.qtr _year, FISCALMONTH.fis _month,
Query1.[users.Name], Query1.username , Query1.scrub, Query1.qa, Query1.comp, Query1.acw, Query1.aht, Query1.aht_disp , Query1.events, Query1.do, Query1.abg, Query1.tas, Query1.other, Query1.css
From FISCALMONTH Left Join
(Select STATS06.*, users.username, users.id, users.Name
From STATS06 Inner Join users On STATS06.userid = users.id
Where users.username = 'KLewis') As Query1 On FISCALMONTH.id = Query1.fmid Where FISCALMONTH.qtr _year = '4th Qtr FY-06'

Only difference on my asp page the 'KLewis' and '4th Qtr FY-06' are variables, but i changed them to the defined to figure out why this is working. Here is the error I'm getting.

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'stats06 INNER JOIN users ON stats06.userid = users.id WHERE users.id = 3419'.

/kc cmc/ams/ams/docs/qtr_doc.asp, line 117


I tried placing [] around the subquery, when I did that I got a slightly different error.

Microsoft JET Database Engine error '80040e37'

The Microsoft Jet database engine cannot find the input table or query 'SELECT stats06 INNER JOIN users ON stats06.userid = users.id WHERE users.id = 3419'. Make sure it exists and that its name is spelled correctly.

/kc cmc/ams/ams/docs/qtr_doc.asp, line 117

The tables are there and are spelled correctly. The database is Access 2003, I can create the query in access and it works. I can also get the query to run in a SQL query builder and send it to access and it works. Any one have any ideas?? I'm so in need of some help!
Oct 31 '06 #1
9 1786
timber910
39 New Member
Still needing some help. I got my query to work, however I am getting a type mismatch. Here is my SQL Query.

Select fiscalmonth.id, fiscalmonth.qtr _year, fiscalmonth.fis _month, S.[users.Name], S.username, S.scrub, S.qa, S.comp, S.acw, S.aht, S.aht_disp, S.events, S.do, S.abg, S.tas, S.other, S.css FROM fiscalmonth LEFT JOIN (SELECT stats06.*, users.username, users.id, users.Name FROM stats06 INNER JOIN users On stats06.userid = users.id WHERE users.name = '&id2&') AS S On fiscalmonth.id = S.fmid WHERE fiscalmonth.id = 10

But i can use this query:

fiscalmonth LEFT JOIN stats06 ON fiscalmonth.id = stats06.fmid WHERE userid = "&id2&" AND fmid = 10

(and not get the results I wanted) but no type mismatch on any of the items pulled from the query with I use the formatnumber. Is there a reason for this? Any help would be wonderful!!!
Nov 7 '06 #2
scripto
143 New Member
assuming id2 is a parameter try this

...WHERE users.name = id2)
Nov 8 '06 #3
timber910
39 New Member
assuming id2 is a parameter try this

...WHERE users.name = id2)
Its a variable that set as the parameter. Tried without the '& &' got more errors than before.
Nov 12 '06 #4
willakawill
1,646 Top Contributor
Its a variable that set as the parameter. Tried without the '& &' got more errors than before.
Hi. It might work to ensure that there is white space around id2 so that it is not concatenated with the text before or after. That would cause the error you are getting.

"userid = " & id2 & " AND fmid = 10"
Nov 12 '06 #5
timber910
39 New Member
Hi. It might work to ensure that there is white space around id2 so that it is not concatenated with the text before or after. That would cause the error you are getting.

"userid = " & id2 & " AND fmid = 10"
with the " " I get a datatype error as the id2 is a number. I did try something very close to this suggestion and it it working. Still trying to figure out why both querys will run one with the formatnumber and works and the other one gets a datatype mismatch. Its sill very odd.
Nov 13 '06 #6
willakawill
1,646 Top Contributor
with the " " I get a datatype error as the id2 is a number. I did try something very close to this suggestion and it it working. Still trying to figure out why both querys will run one with the formatnumber and works and the other one gets a datatype mismatch. Its sill very odd.
So what is it that worked?
Nov 13 '06 #7
timber910
39 New Member
Still doesn't work. I still get a type mismatch. Which is still odd, something to do with access I'm guessing but. I had to do two different querys instead of using the joined statement. Hopefully I can get my database moved to SQL Server2005 in the near future and I think some of the problem could be solved. Thanks for the help!
Nov 21 '06 #8
AricC
1,892 Recognized Expert Top Contributor
Just a thought, have you triple checked your data types on both ends?
Nov 21 '06 #9
timber910
39 New Member
Just a thought, have you triple checked your data types on both ends?

Data types in the database are text. Tried triming and not. One query pulls and can do the formatnumber without any issues and the other one doesn't.
Nov 22 '06 #10

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

Similar topics

29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
9
3122
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
3
9788
by: Philip Yale | last post by:
A colleague of mine has a query which fails to run under SQLAgent batch with the following error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. (Error 242) The statement has been terminated. (Error 3621). The step failed. He can run the same query sucessfully via query analyzer (i.e. no errors, and it does what he wants)
2
2385
by: Mattyboy | last post by:
Guys I have built a database with saved queries that runs fine in Access but when I call it from the web using ASP, an exception occurs. I have tried multiple ways of testing the databases with the following results. www.brinkster.com has a tool on their free asp hosting where you can dump an access .mdb database on there and then run SQL queries against it. Using Access databases it is possible to just call the query by using its...
7
2574
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need a little more help on one more point. This is what i've got. I have code that hunts for updated appointments in a public folder based on the order that happens to be open (code fires on an on open event) This works fine and updates my
6
1681
by: Liz Malcolm | last post by:
Hello and Thanks in advance for any help. I am using Access 2000. I have a data entry form that opens a main form (using the On Click event of the combo box ) with tab controls and 1 subform on the last tab control. The main form is opened using a where clause to restrict the contact type. The subform is built on a separate table that lists other contact types that the contact could be a member of. Example a volunteer could also be a...
1
537
by: Ron | last post by:
Hi, Does a make table query have limitations that a select query doesn't have? This is my problem. I've got a make table query I'll call qrymktblTemp--it combines a few different tables and queries to form a new table that I then manipulate in various ways. It's worked well for all the records that qualify (like, it only includes records from tblBills that have a blank in "printed" field and leaves out ones that the "printed" field...
5
7357
by: elitecodex | last post by:
Hey everyone. I have this query select * from `TableName` where `SomeIDField` 0 I can open a mysql command prompt and execute this command with no issues. However, Im trying to issue the same command inside of mysql_real_query and I keep on getting this error back. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
2
2700
by: Cindy | last post by:
I have an Access 2003 database with a query that works fine on my PC but does not work on another PC. My PC has older versions of Access installed as well as 2003 - the other PC only has Access 2003. The query is as follows: SELECT tblOrganization.strOrgName, tblPerson.strNameL, tblPerson.strNameF, tblPersonFCL_Courses.lngIDPerson, tblPersonFCL_Courses.strHOTest, tblPersonFCL_Courses.strCert, tblPersonFCL_Courses.ysnProcessed,...
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.