Results 1 to 2 of 2

Thread: IIF question

  1. #1
    Join Date
    Sep 2003

    Red face Unanswered: IIF question

    I am not really familiar with Access. I usually used Transact-SQL with SQL Server. In my present case, I need to used the Access query tool and I need to used the CASE function but I have read that you have to used the IIF statement in Access.
    Since I am not really familiar with Access, could someone tell me what I am doing wrong. Here's what I have:

    I having two table one called tbl_Part and the other is called tbl_Part_Assy.
    I am having a field called PriceOption. The type for this field is Bytes. It's storing the answer made by the user by clicking a option on a subform: 1 = PriceSupplier, 2= PriceAssy, 3= PriceLastSupplier. Depending on the choice made by the user (1, 2 or 3) this will affect the textbox price on the detail of another subform. Here is the basic query:

    SELECT tbl_Part_Assy.No_Part, tbl_Part_Assy.No_Part_Assy,
    tbl_Part_Assy.Qty, tbl_Part.PriceOption,
    tbl_Part.PriceSupplier, tbl_Part.PriceAssy,
    tbl_Part.PriceLastSupplier, tbl_Piece_Assemblage.Note,
    tbl_Part.Code_Part, tbl_Part.Price
    tbl_Part ON tbl_Part_Assy.No_Part_Assy = tbl_Part.No_Part

    Here is what trying to do. I am adding this to my query to pass the value to my subform


    Can anybody tell me what I am doing wrong. I hope I am explicit enough. Thanks in advance.

  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    This is programming logic, not SQL logic. You can't use an SQL statement to set a value on a form.

    This statement should be written as VB code in the form's module, either tied to the AfterUpdate events of your controls, or to a command button.

    Use the standard If Then Else syntax in VB.
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts