+ Reply to Thread
Results 1 to 4 of 4

how to use if statement in Query

  1. how to use if statement in Query

    SELECT Account.SlNo, Account.Customer, Account.Contract, Account.[Call #], Account.[DD250/DSVL], Account.POP, Account.[Invoice Date], Account.Inv, Account.Amount, Account.Status, Account.Comments
    FROM Account
    WHERE (((Account.Customer)=forms!Report!Text13) And IF ( ((Account.Status)=forms!Report!Text35) ) = 'Unpaid'
    BEGIN
    ( ((Account.Status)='UnPaid' Or (Account.Status)='Not Paid') )
    END );

    Actually , i need to to get unpaid and not paid records from the table "Account", Status is getting from the textbox at runtime, how can i write the above code , it is giving error ( I'm doing this in MS- Access)

  2. Re: how to use if statement in Query

    Hi,

    What is the error code you got.
    Thanks and Regards,
    Gitesh Trivedi
    Dbametrix Solutions

  3. Re: how to use if statement in Query

    if statement can be used in a sql query. i m giving here an example, try it:

    select * from table if name='ascon';

  4. Re: how to use if statement in Query

    I will try sql query that is given by you but it is create problem.
    Please give proper solution soon.
    Thanks.

+ Reply to Thread