Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Unanswered: How to retreive data from one subform into another subform!

    I have subform 1(mod1)
    it has another subform(mod2) and a text box(UNIT COST)
    subform(mod2) has another text box(quantity purchased and a subform(mod3)
    mod3 has a calculate button and an empty text box(extended cost)

    unit cost is retreived from a database table
    quantity purchase is entered by the user
    and then they are both multiplied and displayed in the extended cost text box in mod3!
    What should I code behind the calculate button on mod3 to retreive the values in unit cost textbox on mod1 and the quantity purchased text box on mod2, into mod3 variables to multiply the values and display the results in the extended cost text box?
    please PM me for more detailed info. if you think you have a solution!
    Last edited by kaydash; 11-27-05 at 10:27.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Providing all forms are open, you can try this in the OnClick event of your Calculate button in mod3:

    Simple Code.....
    Code:
    Me.[extended cost] = Nz(Form_mod1.[unit cost], 0) * Nz(Form_mod2.[quantity purchased], 0)
    Extended code....
    Code:
    If IsNull(Form_mod1.[unit cost]) = True Then
       MsgBox"No Unit Cost Provided...Calculation Canceled.", _
    	   vbExclamation, "Need Unit Cost"
    ElseIf IsNull(Form_mod2.[quantity purchased]) = True Then
       MsgBox"No Purchase Quantity Provided...Calculation Canceled.", _
    	   vbExclamation, "Need Purchase Quantity"   
    Else
       Me.[extended cost] = Form_mod1.[unit cost] * Form_mod2.[quantity purchased]
    End If
    or something like that.....

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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