correct algebric signs

User avatar
sal21
PlatinumLounger
Posts: 4353
Joined: 26 Apr 2010, 17:36

correct algebric signs

Post by sal21 »

I have two table in access database:
table
table1

table:
f1(text) f2 (numeric double)
AA -150
BB 25

ecc...

table1
f1(text) f2 (text)
AA +
BB -

Now i have see with attention in table the algebric signs are wrong!!!!!!!!!!!!!!!

How to correct the f2 in table based the new correct sign matching f1>f1 and return f2 of table with correct signs

in this case the new AA is +150 BB -25

With a query, please

Note:
i use jet ado conn and vb6 classic
f1 and f2 aere the name of fields in table
i can have in f2 of table a 0 (zero value)

User avatar
HansV
Administrator
Posts: 78417
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: correct algebric signs

Post by HansV »

UPDATE table1 INNER JOIN table ON table1.f1=table.f1 SET table1.f2=IIf(table.f2<0, "-","+")
Best wishes,
Hans