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

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

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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved 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


Nov 12 '05 #1
6 1634
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.69002$hf1.48297@lakeread06...
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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved 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


Nov 12 '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_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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '1' )'.


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

Peter

--
No mails please.
Nov 12 '05 #3
"MacDermott" <ma********@nospam.com> wrote in message
news:Fk****************@newsread1.news.atl.earthli nk.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.69002$hf1.48297@lakeread06...
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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved

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



Nov 12 '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.69002$hf1.48297@lakeread06...
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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved 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


Nov 12 '05 #5
DFS
Phil,

Try

Format(event_date,"yyyy") = '2004'

or

Format(event_date,"yyyy") = 2004


"Phil Powell" <so*****@erols.com> wrote in message
news:KX%Jb.69002$hf1.48297@lakeread06...
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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved 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


Nov 12 '05 #6
Actually the second part is fine, the event_is_reserved 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*******************@newssvr33.news.prodigy. 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.69002$hf1.48297@lakeread06...
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'

Syntax error in date in query expression 'show_entry = '1' and
((Year(event_date) = #2004# and event_is_reserved = '0') or
event_is_reserved = '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_reserved, event_img_path, event_img_alt,
event_member_id, " &_
" event_is_email_notify " &_
"from event " &_
"where show_entry = '1' " &_
" and ((Year(event_date) = #" & DatePart("YYYY", Date) & "# and
event_is_reserved = '0') or " &_
" event_is_reserved = '1' " &_
" )"
Response.Write(sql)
set rs = conn.execute(sql)

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_reserved field is '1' or if both the event_is_reserved

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



Nov 12 '05 #7

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

Similar topics

20
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...
5
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...
2
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...
16
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...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
4
by: Robert | last post by:
What is the syntax to use in a VBA script to execute a pass-through? Thanx
9
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...
6
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...
4
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.