Ask Your Question
0

How to create an Update query in BASE SQL [closed]

asked 2014-04-13 22:28:05 +0200

MQ-818 gravatar image

SYNTAX: UPDATE table SET column = Expression [, ...] [WHERE Expression];

UPDATE "tblMainCustInfo" SET "Cell_Phone1_Name" = 'Some text' WHERE "Cell_Phone1_Name" IS NULL

I tried this but NO GO....!!!!

Not sure how to solve this.

FYI: I am super new in SQL; so please be patient with me.

Thanks in Advance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 20:22:03.987242

1 Answer

Sort by » oldest newest most voted
1

answered 2014-04-14 19:57:20 +0200

MQ-818 gravatar image

So after a long night...LOL (Sleeping...not stayed up); this morning I bump into the answer of my question. In fact it was right here...https://www.youtube.com/watch?v=2d82wbmJqYo

Two thumbs up to TheFrugalComputerGuy (I am glad people like this exist in this planet earth)

Anyway....here is the bottom line

  1. If you are like me coming from MS Access (MDB) background; you are spoiled by Microsoft. Things are very easy and simple way to do this update query.
  2. In order to run SQL UPDATE query in BASE (ODB) there are two avenues a) Use a macro b) Use TOOLS -> SQL ... [After opening the DB, Look up the Menu]

    of course with my drop of knowledge; I am not ready to use the SQL in a macro yet. YES, my next step is macro. So I can use SQL from any form using a button.

USING Tools -> SQL... After a lot of Google; one thing was clear to me; One must use some sort of Index field to achieve UPDATE SQL.

So my attached picture should say thousand words.....Hope it is helpful.

 -- My table name is tblMainCustInfo

 -- Updating field Cell_Phone2_Name

 -- ID is an indexed field

 -- Two Single Quote next to each other is to call EMPTY field(s)    as
  shown below

 -- "FieldName" Like ''

 -- Please be careful about where to use Single or Double Quote

--sql start

UPDATE

"tblMainCustInfo"

SET

"Cell_Phone2_Name" ='Cell Phone 2'

WHERE

"ID" BETWEEN 1 AND 700 AND "Cell_Phone2_Name" IS NULL

--sql end

After putting your SQL in the top window just click EXECUTE / Look for a successful run

Good Luck! image description

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-13 22:28:05 +0200

Seen: 12,705 times

Last updated: Apr 14 '14