473,670 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't find syntax error in Access query - lost!

select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.

/soa/val/event/calendar.asp, line 258

I'm totally lost here and I don't have the original .sql statement to have
produced the "event" table schema, so that won't help either. Here is line
258+:

sql = "select event_date, event_name, event_text, event_is_public , " &_
" event_is_reserv ed, event_img_path, event_img_alt,
event_member_id , " &_
" event_is_email_ notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_da te) = #" & DatePart("YYYY" , Date) & "# and
event_is_reserv ed = '0') or " &_
" event_is_reserv ed = '1' " &_
" )"
Response.Write( sql)
set rs = conn.execute(sq l)

Guys, I don't know what to do and I'm in a huge deadline to have this fixed
by Monday AM and I'm completely stuck. Furthermore, I have no way of
accessing the original Access .mb file since it's on www.brinkster.com and
they forbid you from directly accessing any .mb file w/o their web-based
tool (which cannot tell you what the schema is).

My goal is to filter out a list of events from the event table where either
the event_is_reserv ed field is '1' or if both the event_is_reserv ed field is
'0' and the event_date is of the current year (event_date's format is
'/mm/dd/yyyy').

Original site breakage at:
http://www3.brinkster.com/soa/val/event/calendar.asp

Help!

Thanx

Phil


Jul 19 '05 #1
5 1682
I don't know if this is your problem, but the Year() function returns a
variant of type Integer, so you don't need the # delimiters around 2004.

HTH
- Turtle

"Phil Powell" <so*****@erols. com> wrote in message
news:KX%Jb.6900 2$hf1.48297@lak eread06...
select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.

/soa/val/event/calendar.asp, line 258

I'm totally lost here and I don't have the original .sql statement to have
produced the "event" table schema, so that won't help either. Here is line 258+:

sql = "select event_date, event_name, event_text, event_is_public , " &_
" event_is_reserv ed, event_img_path, event_img_alt,
event_member_id , " &_
" event_is_email_ notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_da te) = #" & DatePart("YYYY" , Date) & "# and
event_is_reserv ed = '0') or " &_
" event_is_reserv ed = '1' " &_
" )"
Response.Write( sql)
set rs = conn.execute(sq l)

Guys, I don't know what to do and I'm in a huge deadline to have this fixed by Monday AM and I'm completely stuck. Furthermore, I have no way of
accessing the original Access .mb file since it's on www.brinkster.com and
they forbid you from directly accessing any .mb file w/o their web-based
tool (which cannot tell you what the schema is).

My goal is to filter out a list of events from the event table where either the event_is_reserv ed field is '1' or if both the event_is_reserv ed field is '0' and the event_date is of the current year (event_date's format is
'/mm/dd/yyyy').

Original site breakage at:
http://www3.brinkster.com/soa/val/event/calendar.asp

Help!

Thanx

Phil


Jul 19 '05 #2
On Sun, 4 Jan 2004 16:51:36 -0500, Phil Powell wrote:
select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.


Remove the # around 2004. Year returns an integer, not a date type.

Peter

--
No mails please.
Jul 19 '05 #3
"MacDermott " <ma********@nos pam.com> wrote in message
news:Fk******** ********@newsre ad1.news.atl.ea rthlink.net...
I don't know if this is your problem, but the Year() function returns a
variant of type Integer, so you don't need the # delimiters around 2004.

HTH
- Turtle
Also, DatePart does not return a date, but rather a variant of type integer.

"Phil Powell" <so*****@erols. com> wrote in message
news:KX%Jb.6900 2$hf1.48297@lak eread06...
select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.

/soa/val/event/calendar.asp, line 258

I'm totally lost here and I don't have the original .sql statement to have produced the "event" table schema, so that won't help either. Here is line
258+:

sql = "select event_date, event_name, event_text, event_is_public , " &_
" event_is_reserv ed, event_img_path, event_img_alt,
event_member_id , " &_
" event_is_email_ notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_da te) = #" & DatePart("YYYY" , Date) & "# and
event_is_reserv ed = '0') or " &_
" event_is_reserv ed = '1' " &_
" )"
Response.Write( sql)
set rs = conn.execute(sq l)

Guys, I don't know what to do and I'm in a huge deadline to have this

fixed
by Monday AM and I'm completely stuck. Furthermore, I have no way of
accessing the original Access .mb file since it's on www.brinkster.com and they forbid you from directly accessing any .mb file w/o their web-based
tool (which cannot tell you what the schema is).

My goal is to filter out a list of events from the event table where

either
the event_is_reserv ed field is '1' or if both the event_is_reserv ed

field is
'0' and the event_date is of the current year (event_date's format is
'/mm/dd/yyyy').

Original site breakage at:
http://www3.brinkster.com/soa/val/event/calendar.asp

Help!

Thanx

Phil



Jul 19 '05 #4
As mentioned by others, Year(event_date ) is an integer not a date, you need
to remove the #'s. Also, you have single quotes around the numbers 0 and 1.
Are these in a field defined as text or in a number field. If the field is a
text field, the quotes should be there, if the field is a number field the
quotes shouldn't be there.

--
Wayne Morgan
Microsoft Access MVP
"Phil Powell" <so*****@erols. com> wrote in message
news:KX%Jb.6900 2$hf1.48297@lak eread06...
select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.

/soa/val/event/calendar.asp, line 258

I'm totally lost here and I don't have the original .sql statement to have
produced the "event" table schema, so that won't help either. Here is line 258+:

sql = "select event_date, event_name, event_text, event_is_public , " &_
" event_is_reserv ed, event_img_path, event_img_alt,
event_member_id , " &_
" event_is_email_ notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_da te) = #" & DatePart("YYYY" , Date) & "# and
event_is_reserv ed = '0') or " &_
" event_is_reserv ed = '1' " &_
" )"
Response.Write( sql)
set rs = conn.execute(sq l)

Guys, I don't know what to do and I'm in a huge deadline to have this fixed by Monday AM and I'm completely stuck. Furthermore, I have no way of
accessing the original Access .mb file since it's on www.brinkster.com and
they forbid you from directly accessing any .mb file w/o their web-based
tool (which cannot tell you what the schema is).

My goal is to filter out a list of events from the event table where either the event_is_reserv ed field is '1' or if both the event_is_reserv ed field is '0' and the event_date is of the current year (event_date's format is
'/mm/dd/yyyy').

Original site breakage at:
http://www3.brinkster.com/soa/val/event/calendar.asp

Help!

Thanx

Phil


Jul 19 '05 #5
Actually the second part is fine, the event_is_reserv ed is of type char
while event_date is a date field. I did not know that Year() converts a
date type to an integer, thanx, everything works now.

Phil

"Wayne Morgan" <co************ *************** @hotmail.com> wrote in message
news:o6******** ***********@new ssvr33.news.pro digy.com...
As mentioned by others, Year(event_date ) is an integer not a date, you need to remove the #'s. Also, you have single quotes around the numbers 0 and 1. Are these in a field defined as text or in a number field. If the field is a text field, the quotes should be there, if the field is a number field the
quotes shouldn't be there.

--
Wayne Morgan
Microsoft Access MVP
"Phil Powell" <so*****@erols. com> wrote in message
news:KX%Jb.6900 2$hf1.48297@lak eread06...
select event_date, event_name, event_text, event_is_public ,
event_is_reserv ed, event_img_path, event_img_alt, event_member_id ,
event_is_email_ notify from event where show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )

produces this error:

Microsoft JET Database Engine error '80040e07'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_da te) = #2004# and event_is_reserv ed = '0') or
event_is_reserv ed = '1' )'.

/soa/val/event/calendar.asp, line 258

I'm totally lost here and I don't have the original .sql statement to have produced the "event" table schema, so that won't help either. Here is line
258+:

sql = "select event_date, event_name, event_text, event_is_public , " &_
" event_is_reserv ed, event_img_path, event_img_alt,
event_member_id , " &_
" event_is_email_ notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_da te) = #" & DatePart("YYYY" , Date) & "# and
event_is_reserv ed = '0') or " &_
" event_is_reserv ed = '1' " &_
" )"
Response.Write( sql)
set rs = conn.execute(sq l)

Guys, I don't know what to do and I'm in a huge deadline to have this

fixed
by Monday AM and I'm completely stuck. Furthermore, I have no way of
accessing the original Access .mb file since it's on www.brinkster.com and they forbid you from directly accessing any .mb file w/o their web-based
tool (which cannot tell you what the schema is).

My goal is to filter out a list of events from the event table where

either
the event_is_reserv ed field is '1' or if both the event_is_reserv ed

field is
'0' and the event_date is of the current year (event_date's format is
'/mm/dd/yyyy').

Original site breakage at:
http://www3.brinkster.com/soa/val/event/calendar.asp

Help!

Thanx

Phil



Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
2910
by: Jeff Uchtman | last post by:
I'd like to combine (if possible these two statements drawing from a total of 3 tables. sql = "SELECT p.Sub_ID, p.Cat_ID, p.Sub_Name, COUNT(c.Sub_ID) as ct FROM Subs p LEFT JOIN Links c ON p.Sub_Id = c.Sub_Id GROUP BY p.Sub_ID, p.Cat_ID, p.Sub_Name ORDER BY p.Sub_Name" sql = "select * from Subs inner join Cats on Cats.Cat_ID=Subs.Cat_ID ORDER BY Sub_Name"
2
11854
by: Jonathan | last post by:
I am looking for a simple way to check if a database table exists. I keep getting advice to use "Try.. Catch" and other error handling methods, but I obviously don't want to have to display an error message and stop the process every time someone loads the script after the table is created because that would mean the page could only ever run once which of course not the solution I was looking for. I simply want to know how I can check...
16
7275
by: !TG | last post by:
I have a table with a date field. All I want to do it get all the records with a date before today. I tried the following: "SELECT * FROM StateLicenses Where (Exp < #07/26/2005#) Order By BranchNo,Satellite;" "SELECT * FROM StateLicenses Where (Exp < 07/26/2005) Order By BranchNo,Satellite;" "SELECT * FROM StateLicenses Where (Exp < " & Now() & ") Order By BranchNo,Satellite;" "SELECT * FROM StateLicenses Where (Exp < #" & Now() & "#)...
6
1643
by: Phil Powell | last post by:
select event_date, event_name, event_text, event_is_public, event_is_reserved, event_img_path, event_img_alt, event_member_id, event_is_email_notify from event where show_entry = '1' and ((Year(event_date) = #2004# and event_is_reserved = '0') or event_is_reserved = '1' ) produces this error: Microsoft JET Database Engine error '80040e07'
4
11519
by: Robert | last post by:
What is the syntax to use in a VBA script to execute a pass-through? Thanx
9
18545
by: Mike Bridge | last post by:
I am using MS Access 2003, and I typed in a query in SQL view which was working fine. Now when I open it, it gives me the error "Join expression not supported". Apparently, Access "fixed" it for me. Unfortunately, I can't correct it because when I click "OK", the window disappears. I don't see any way to open the query directly in SQL view, and both the Design and Data views exit as soon as I close the error dialog. Is there any way...
6
4868
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
4
12428
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
6
5994
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into it has been troublesome to say the least. My ASP.NET script is supposed to execute an INSERT INTO statement in order to add a user to the database. Here is a sample:
0
8466
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
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8813
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
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
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
4208
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
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.