I am trying to run the following update query in code.
UPDATE TableTest SET STATUS = "A" WHERE (Code <> "X") AND (Code <>
"J") ORDER BY DOB;
I am getting an error, "Missing Semicolon (;) at end of SQL statement".
Please tell me what is wrong with the syntax. It worked in Access 97.
But in Access 2003, it is so fussy!
I appreciate your help. Thanks, Erika 4 4247
erika wrote: I am trying to run the following update query in code.
UPDATE TableTest SET STATUS = "A" WHERE (Code <> "X") AND (Code <> "J") ORDER BY DOB;
I am getting an error, "Missing Semicolon (;) at end of SQL statement". Please tell me what is wrong with the syntax. It worked in Access 97. But in Access 2003, it is so fussy!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You don't need an ORDER BY clause in an UPDATE statement. Otherwise,
nothing else appears wrong w/ it.
What do you mean you're trying to run it in code? Do you mean in VBA?
Have you set it up like this:
Dim strSQL As String
strSQL = "UPDATE TableTest SET Status = 'A'" & _
"WHERE Code Not In ('X', 'J');"
Note the use of single quotes inside the strSQL. Double quotes delimit
the string; therefore, we must use single quotes inside double quotes.
I changed the criteria to use a more intuitive construct. Read the JET
SQL Reference (Access Help) for more info on the IN predicate.
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQmaWX4echKq OuFEgEQI6qACglh tCE6ceGz5xtXf8c g4NJaK7XGMAn3+u
XHW6NUAmullw6UE eHCKYxTSH
=+39E
-----END PGP SIGNATURE-----
I have a statement in VB to execute that sql.
strSQLUpdate="U PDATE TableTest SET STATUS = "A" WHERE (Code <> "X") AND
(Code <> "J") ORDER BY DOB; "
DB.Execute strSQLUpdate
But even if I run it from the SQL view of a Query, it doesn't work.
I understand that I don't need an Order By for the update. The way the
form works, if a user has sorted their data, and then wants to update a
field's value, the update sql that is built by the form uses the entire
sql behind the form. And like I said, it works in Access 97. So, what
is new and improved in Access 2003 that makes this query not runnable?
Erika,
Forgive me if I add my two cents when I am not sure my suggestion is any
better than MGFoster. Ditto on not needing the ORDER BY clause. Will this
work?
UPDATE TABLETEST SET STATUS = 'A' WHERE CODE NOT IN ('X','J');
I found a difference in the use of quotes in Access 2002 in some cases. SQL
Server uses single quotes to delimit text and Jet uses both double-quotes
and single quotes. There is an option in 2002 to enforce SQL Server syntax
rules. If this is enabled then double-quotes around text begin to cause a
problem. I rewrote your update statement with single-quotes thinking that
this may be part of the issue. Let me know if I am on the right track.
--
Alan Webb kn*******@SPAMh otmail.com
"It's not IT, it's IS"
"erika" <mi******@gmail .com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. . I am trying to run the following update query in code.
UPDATE TableTest SET STATUS = "A" WHERE (Code <> "X") AND (Code <> "J") ORDER BY DOB;
I am getting an error, "Missing Semicolon (;) at end of SQL statement". Please tell me what is wrong with the syntax. It worked in Access 97. But in Access 2003, it is so fussy!
I appreciate your help. Thanks, Erika
Thank you both. It was the ORDER BY. This sequence of button clicks
must not have been tested in my '97 program, because it fails there,
too, and I never knew it. I appreciate your time and patience. Erika This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jannordgreen |
last post by:
I am using Winxp and Ms Access 2003.
I get this error message:
error 3137, Missing semicolon (;) at end of SQL statement
when I run this code:
Dim I As Integer
For I = 0 To Me.lstparcelblock.ListCount - 1
|
by: Prashanth Badabagni |
last post by:
Hi,
Can any body tell me how to print "hello,world" with out using semicolon
Thanks in advance ..
Bye
Prashanth Badabagni
|
by: vasudevmukherjee |
last post by:
Hi! Anybody there who can answer me on my following code:
When I try to compile this code, I get message of a missing ']' on the
line 3 i.e. int a;, why is this happening
Thanks in anticipation.
VASUDEV MUKHERJEE
|
by: kalyan. |
last post by:
how do i overcome this problem ??
Thanku in Advance .
|
by: Ken |
last post by:
Hi all,
I want to printf a sentence with a semicolon, for examples:
printf(" I like C language; You like C++ language.");
But C compiler alway identify the semicolon as a end of a sentence and
presents an error.
My question is:
How to printf the semicolon ";" in C language?
| |
by: liz0001 |
last post by:
Hi,
I am getting this error when I try to run my code:
Missing semicolon (;) at end of SQL statement
However, there is a semicolon at the end of my statement. Here is the statement:
INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,FourthID,AddID) VALUES ('1','6/22/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='12',AddID='13';
*I am generating this SQL from an...
|
by: P2P |
last post by:
Hi all,
I build my project on VS 2005 and get this error:
c:\dx90sdk\include\strmif.h(27392) : error C2146: syntax error : missing ';'
before identifier 'lpSurf'
can you help me how to fix this?
Thanks for any help.
|
by: im2cre8iv |
last post by:
Here is my code where I am receiving the error:
#include <fstream>
#include "BinaryTree.h"
using namespace std;
Node* BinaryTree::MakeTree(ifstream& infile)
{
char name;
infile>>name;
|
by: radhikabece |
last post by:
I m writhing the code as below in the button click event:
Dim count As String = "select max(CutomerId) from CustomerInfo"
cn.Open()
cmd = New OleDbCommand(count, cn)
Dim max1 As String = cmd.ExecuteScalar()
max = Convert.ToInt32(max1)
cn.Close()
cn.Open()
Dim im As String = "insert into CustomerInfo(Address1,Address2,Email,PassPortNo) values('" & txtadd1.Text & "','" & txtadd2.Text &...
|
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...
|
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,...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |