from one field write to other field is that posible ?? in access

Hi ! All!
i have table_A with  field_A with 4 numbers  1234, 0123, 7689, or any number combination
but
is the number have an 0 in field_A  i need  to  put in field_B an  1  
the 0 could be in any position.

is that possible ?
GISELA TOWERAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try:

update yourTable set field_B = 1 where instr(field_A, '0' ) > 0

Open in new window

GISELA TOWERAuthor Commented:
where i put it?
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>where i put it?
you can create a new Query and execute that.

>>is the number have an 0 in field_A  i need  to  put in field_B an  1
This Update SQL statement will update the field_B with a "1" if a "0" was found in the field_A 's value.

or you can tell us "when" and "how" you want your records to be updated.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

GISELA TOWERAuthor Commented:
I mean i could have  8902 , 0234, 4560, the 0 could be in any position
of the 4 digit
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
yup, that's why we are using instr function in the SQL statement to search for the character's location.

for more ref:

MS ACCESS: INSTR FUNCTION
http://www.techonthenet.com/access/functions/string/instr.php
GISELA TOWERAuthor Commented:
is 0 is in any of the 4 digit position of field_A  then
1 should be write to field_B
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>is 0 is in any of the 4 digit position of field_A  then
>>1 should be write to field_B

exactly... so have you try to run the Update SQL statement that I posted previously?

update yourTable set field_B = 1 where instr(field_A, '0' ) > 0
GISELA TOWERAuthor Commented:
how i can do that?
don't know how
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try to read through this article:

Create and run an update query
https://support.office.com/en-us/article/Create-and-run-an-update-query-9dddc97c-f17d-43f4-a729-35e5ee1e0514

OR directly:

If you're comfortable working with SQL, you can also write an UPDATE statement by using SQL view. To use SQL view, create a blank, new query, and then switch the SQL view.

SQL version: UPDATE statement
https://support.office.com/en-us/article/Create-and-run-an-update-query-9dddc97c-f17d-43f4-a729-35e5ee1e0514#__toc336583665
GISELA TOWERAuthor Commented:
ok i did in test table but nothing happens in field_B
testA.pngtestB.pngtestC.png
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
can you show us the values of col A ?
GISELA TOWERAuthor Commented:
this is test1 table
with field A and field B

testD.png
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
alternatively, do a select statement and see what locations are returned...

Select a.*, instr( A, '0' ) as location from Test1 as a

Open in new window

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
make sure you click the "! Run" button to run the SQL statement?

(image copied from Internet)
run button
GISELA TOWERAuthor Commented:
ok i have an problem
your solution is almost working
but
when the the four digit beging with 0
is not working for that number like 0897 0999
do i have ti change to text format ?
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
what do you get if you run:
 instr( '0897' , '0' )
 instr( '0999' , '0' )

is that 1 is being returned?
GISELA TOWERAuthor Commented:
is field A is number format
i write  0022 but just 22 appear
and does not count the 0
so return 0 no the 1  we need  to see
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
i see, so try like this instead...

update Test1 set B = 1 where instr(right('000' & A, 4), '0' ) > 0

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GISELA TOWERAuthor Commented:
Ryan Chong
your solution is rigth

i would like to make another short question to you
you are good !

if a have  5 colums
                      a    b    c    d   e
Record A         1   1          1       = total
but want to count the row total  for record a
the numbers 1 is in short text format
how can i do tthat ?
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you may try like:
select a + b+ c+ d+ e as total from yourTable

Open in new window

if that doesn't work, then try like:
select val(a) + val(b)+ val(c)+ val(d)+ val(e) as total from yourTable

Open in new window

GISELA TOWERAuthor Commented:
the best !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.