Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

if statement with value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
samuel - 31 Jul 2006 21:46 GMT
i have 2 standard fields
[Doses]
[TxnType]

i want to have the following occur
IF [TXNTYPE]=R
THEN [DOSES]*(-1)
ELSE [TXNTYPE]

i want to value of this to be stored in [Field3]

is this possible?
jade.skaggs@gmail.com - 31 Jul 2006 22:18 GMT
Run the following update query and it should update all of your rows as
requested.

UPDATE [MyTable] SET [Field3] =
IIf([TXNTYPE]="R",[DOSES]*(-1),[TXNTYPE]);

> i have 2 standard fields
> [Doses]
[quoted text clipped - 8 lines]
>
> is this possible?
jade.skaggs@gmail.com - 31 Jul 2006 22:21 GMT
IIF works as follows so you can use it in a select, or anything for
that matter

IIF(  [Condition] , [TRUE Branch] , [FALSE Branch]  )

jade.ska...@gmail.com wrote:
> Run the following update query and it should update all of your rows as
> requested.
[quoted text clipped - 14 lines]
> >
> > is this possible?
Ofer Cohen - 31 Jul 2006 23:10 GMT
Using a query you can add another field

Field3: IIF ([TXNTYPE]="R",[DOSES]*-1, [TXNTYPE])

There is no need to store a calculated field, just create a query that
display the desire resault

Select TableName.* , IIF ([TXNTYPE]="R",[DOSES]*-1, [TXNTYPE]) As Field3
From TableName

Signature

Good Luck
BS"D

> i have 2 standard fields
> [Doses]
[quoted text clipped - 8 lines]
>
> is this possible?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.