Results 1 to 3 of 3
  1. #1
    Arsalan is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    11

    Some Quries

    1st Query!


    I have 3 text box on form named txt1 and txt2. I am using txt1 and txt2 for assigning values and txt3 for result.
    I write this formula in txt3: =+[txt1]+[txt2]
    this formula give me perfect result when i provide value in both textboxes but when i don't provide value in any one in this text box then txt3 gone blank. I want that if i insert 5 in txt1 and left txt2 blank then txt3 show me 5 as result.

    2nd Query!
    In this query i want that when i insert some new values in bound control like textbox(bound with datatable) then Sum of this bound textbox which is in form footer will automatically update/Refres.


    thanks in advance.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    1st Query!
    I have 3 text box on form named txt1 and txt2. I am using txt1 and txt2 for assigning values and txt3 for result.
    I write this formula in txt3: =+[txt1]+[txt2]
    This is not a query. It is an expression.
    Try this in txt3 :
    Code:
    =NZ(txt1,0)+NZ(txt2,0)



    2nd Query!
    In this query i want that when i insert some new values in bound control like textbox(bound with datatable) then Sum of this bound textbox which is in form footer will automatically update/Refres.
    As a rule, you shouldn't store the results of a calculation. If the value of one of the fields changes, the calculated value would be wrong. You would have to write code to ensure that the result field is updated if any of the values change.

    If the record source is a query (not a table) , you can add a column to the to calculate the result.
    Example:
    Code:
    SELECT NZ(txt1,0),NZ(txt2,0),NZ(txt1,0)+NZ(txt2,0) AS Result FROM A_Table
    Change "A_Table" to your table name. Set the control source for "txt3" to "Result"

  3. #3
    Arsalan is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    11
    Thanks for 1st query it's working but what i need in 2nd query is that...
    I want that when i enter some number like '5' in (Green Rectangle) txtbox then (Red Rectangle) box will automatically sum.
    which formula resolve this issue?
    Note: Red and Green Rectangle box is not bound controls its unbound textboxes.

    Click image for larger version. 

Name:	Sample.JPG 
Views:	7 
Size:	64.9 KB 
ID:	10794

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 06-05-2012, 10:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums