Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in bound text 2

Status
Not open for further replies.

mai19ea

Technical User
Nov 26, 2005
31
LY
hi all,

in my form i have a unbound text calculating different fields and i put a code in the form to transfer to the bound text as follows;

me.text0 = me.text

my problem is when the unbound text calculate the field the bound text is not changing/updating. its only changing/updating if you go to design view and go back to a form view and its working.

but the code is useless if everytime i calculate a field i go always to design view and go back again to form view just only to update my bound text.

 
Try the code OnChange/AfterUpdate events of the fields that are bieng used for calculation

________________________________________________________
Zameer Abdulla
Help to find Missing people
Seek counsel of him who makes you weep, and not of him who makes you laugh.
 
hello zameer,

is not working with me, only working in

Form_On Current

Me.text0=Me.text1

but still i do the same procedure (i go to design view and return to form view)to update the bound test.

please response if there still possibility.


thanks
 
See an example here. I am using it well & updating to Amount field.
Code:
Private Sub ItemName_Change()
    Rate_Change
End Sub
'========================================
Private Sub Quantity_Change()
    Call Rate_Change
End Sub
'========================================
Private Sub Rate_Change()
    If Rate <> "" And Quantity <> "" Then
        Amount = Format(Val(Rate * Quantity), "###,##0.00")
    Else
        Amount = "0.00"
    End If
End Sub
'========================================

________________________________________________________
Zameer Abdulla
Help to find Missing people
Seek counsel of him who makes you weep, and not of him who makes you laugh.
 
thanks for the reply

but still not working with me.

the fields tha i used for calculation is working which unbound text, what i need is i want to copy from that unbound text to the bound text in order me to update the related table.

i hope you can give me more tips.

many thanks
 
It is as simple as below.
You have 3 fields

Field1
Field2
Total

you will add code like this.
Code:
Private Sub field1_AfterUpdate()
    Me.Total = Me.field1 * Me.Field2
End Sub
'=============================
Private Sub Field2_AfterUpdate()
    Me.Total = Me.field1 * Me.Field2
End Sub
here Total is bound textboxt to field "Total"

________________________________________________________
Zameer Abdulla
Help to find Missing people
Seek counsel of him who makes you weep, and not of him who makes you laugh.
 
mr. zameer, thank a lot.. now this is better and it works.



 
this code will work also if you have more that 2 fields to calculate for example i have 4 fields.

many thanks
 
It can be as many as you need. change the calculation to a sub like
Code:
Sub CalculatedResult()
Dim rslt as Double
rslt=(Me.field1 * Me.Field2)/Me.Field2 '(what ever calc)
Me.TextBoxResult=rslt
end if
Then
Code:
Private Sub field1_AfterUpdate()
    CalculatedResult
End Sub
'============================
Private Sub field2_AfterUpdate()
    CalculatedResult
End Sub
'==================
Private Sub field3_AfterUpdate()
    CalculatedResult
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Seek counsel of him who makes you weep, and not of him who makes you laugh.
 
hello all,

i want to apply the code last 11 Dec 05 9:53 but its not working with me, is there somebody could help me, below are the sample:

Value1 Value2 Balance
F1 F5 F9 = (F1-F5)
F2 F6 F10 =(F2-F6)
F3 F7 F11 =(F3-F7)
F4(Total Value1) F8(Total Value2) F12(Total Bal)

many thanks
 
The CalculatedResult procedure must be in the Form's code module if it use Me.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks for the reply PHV
yes i am in the form's code.

thanks
 
So, what is the problem ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks for your time reading my post, now finally i did it..

thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top