473,399 Members | 4,192 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,399 software developers and data experts.

Syntex Error, Update Multi - colomns - multi feilds in one query .

Dear All,
Hope every thing going fine...

Am trying to run this query , but am getting :
Syntex Erro (missing operator) in query expression 'CASE code .....

My querys is :
Expand|Select|Wrap|Line Numbers
  1. Update tb_details
  2. set quantity = CASE code 
  3. when 8668 then "2"
  4. when 8669 then "3"
  5. when 8670 then "0" 
  6. when 8671 then "2"
  7. END
  8. where 
  9. code   IN (8668, 8669, 8670, 8671) ;
  10.  
where Qunatity is a string value and code is an automatic number .
Access 2007, Sql view

P.S.: i aslo tried for feild other than the code feild , since it could be a Key-word, error still exist
Any Ideas ...
Thnaks in advance
Apr 12 '11 #1

✓ answered by gershwyn

Access does not support the SQL you are trying to use here. The closest equivalent would be to use the Switch function.
Expand|Select|Wrap|Line Numbers
  1. SET quantity = Switch(Code = 8668, "2", Code = 8669, "3")
Though personally, I'd prefer to create a table that cross references the code to the quantity, and use a join to lookup the values. That way any changes or additions could be made directly to the table without increasing the complexity of the SQL statement.

4 1602
jimatqsi
1,271 Expert 1GB
Is this in the right forum? Looks like maybe it should be in the SQL forum.

jim
Apr 12 '11 #2
gershwyn
122 100+
Access does not support the SQL you are trying to use here. The closest equivalent would be to use the Switch function.
Expand|Select|Wrap|Line Numbers
  1. SET quantity = Switch(Code = 8668, "2", Code = 8669, "3")
Though personally, I'd prefer to create a table that cross references the code to the quantity, and use a join to lookup the values. That way any changes or additions could be made directly to the table without increasing the complexity of the SQL statement.
Apr 12 '11 #3
Hey gershwyn thanks for the note Access does not support the SQL you are trying to use here. I didnt know !!!

I'll try to use your statmnt ...

Thanks .
Apr 13 '11 #4
Thanks gershwyn , your statmnt worked just fine, did what it supposed to do :) , thanks a lot

Regards,
Apr 13 '11 #5

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

Similar topics

0
by: VictorCorey | last post by:
Is it possible to use a multi-parameter query in .NET Here's the method Public Function SearchCatalog(ByVal searchString As String, ByVal allWords As String) As OleDbDataReade ' Create the...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
3
by: KevLow | last post by:
Hi, Hope some kind soul can help me out here.. I'm trying to programmatically modify the column headings of a crosstab query such that it can be dynamic based on user specified period (Month...
1
by: Manuel Lopez | last post by:
I get a run-time error 3035 ("system resources exceeded") running DAO code in XP x64 that works fine under 32-bit XP. It updates 405,000 records. Dim dbs as DAO.Database If dbs=Nothing Then Set...
1
by: Nikhil Patel | last post by:
Hi all, I have the following code in the asp.net page added at runtime using RegisterStartupScript. But I get an error in the browser(syntex error-no details). DisplayLookupValues is a function...
606
by: Neil Zanella | last post by:
Hello, I am trying to update an MS access database from ASP.NET. I am using IIS on Windows XP Pro. I can issue SELECT statements from ASP.NET using ADO.NET but I cannot seem to be able to carry...
1
by: andrewcw | last post by:
I have just 1 table that I am updating, the SQL I use to generate the DataTable is complex using multiple tables, however when I view the fieldnames of the DataTable from the DataSet - everything...
0
by: rickmedlin | last post by:
I know this has been posted on elsewhere but I'm stuck. I'm using the following append query to copy an Access query to Excel: INSERT INTO . SELECT * FROM Test; This isn't the real table...
0
by: Ankit Mehta | last post by:
I am new to access and started making a database for a spreadsheet. I am using access 2000. I have a column which displays the total production for a month schuler_month_prod. One column displays...
1
by: Jas Singh | last post by:
Hello, I am a beginner to SQL. I am working on a work related request and receiving the following syntex error: Msg 156, Level 15, State 1, Line 58 Incorrect syntax near the keyword 'AS'. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
agi2029
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,...

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.