Results 1 to 5 of 5

Thread: problems help!

  1. #1
    Join Date
    Dec 2003
    Posts
    49

    Question Unanswered: problems help!

    i have two item . itemA and itemB. each item has two prices. prices1 and prices2.
    example
    itemA price1 500 price2 200
    itemB price1 600 price2 300

    i create an invoice form. users input the name of the item from the combo box and then input the weight of the item.
    the program calculate like this :
    total = (weight-5)*price2 + price 1

    now the problem is
    when i first input itemA or itemB in invoice the program calculates like above. that's fine.
    after the first input of itemA or itemB, i input the next item (it could be itemA or itemB depends on the first input, there's can't be 2 identical item in 1 invoice), the program calculates the same.(that's normal). but i want the second input only calculates like this: (if there's an item (A or B) already in the first input)
    total = (weight-5)*price2
    without involving the price1.

    notes: this calculation only involve itemA and itemB only. another item (C,D,E...) is not necessary to perform this kind of calculation.

    any idea??
    hendra gunadi

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    If I understand this correctly, the second input should only be calculated with the price2 formula if there's already an input? Is that correct?

    If so, you could use an immediate if to determine if there is a value for the first input, and then assign a formula accordingly. Something like:

    =iif(txtbox1.Value = '', '', (weight - 5)*[price2])

    I'm not sure exactly what you were asking... but I think that's what you're getting at. Let me know.

  3. #3
    Join Date
    Dec 2003
    Posts
    49
    yes that's correct
    but you know in an invoice there's a subform (default view datasheet) to input the orders so that one invoice can contains many order of item.
    how to write the code that if the previous record in the subform is "itemA" then use the second calculation.
    i'm sorry if i can't describe it clearly, i really appreciate for your effort to understand my question.
    hendra gunadi

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by hendra1211
    yes that's correct
    but you know in an invoice there's a subform (default view datasheet) to input the orders so that one invoice can contains many order of item.
    how to write the code that if the previous record in the subform is "itemA" then use the second calculation.
    i'm sorry if i can't describe it clearly, i really appreciate for your effort to understand my question.
    This would be accomplished by simply altering the criteria that the IIF() function uses to determine the formula:

    iif(forms!yoursubform!txtwithitem.value = "itemA", (weight - 5)*[price2], '')

    does this work for you?

  5. #5
    Join Date
    Dec 2003
    Posts
    49
    no.
    let me give some example

    first consumer order item A, the total is calculated as normal
    the second order is item B, now the total must not calculated as normal, but only price2 only. so when the second order is
    about to be made it has to check whether there is an order of "item A" previously in the same subform already or not.
    if there isn't then it calculates as normal.
    the program has to do the same when consumer order" item B" first the the "item A."
    or vice versa.
    hendra gunadi

Posting Permissions

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