main form and continuous subform requery

Falcon88

Registered User.
Local time
Today, 12:43
Joined
Nov 4, 2014
Messages
309
hii dears

on main form a textbox ( txt2 ) to gives me the total of subform some field
how to requery that textbox ( txt2 ) after user add new item on the sub form without return to the first record on the subform ?
 
Try requerying the form's recordset intead.

Normally, I would use Recalc, instead of Requery, but I don't know what your code looks like. So, this is what I am saying above.
Code:
Me.Recordset.Requery
Hope that helps...
 
Try requerying the form's recordset intead.

Normally, I would use Recalc, instead of Requery, but I don't know what your code looks like. So, this is what I am saying above.
Code:
Me.Recordset.Requery
Hope that helps...
i try that code under the itemid after update , then under the subform after update but it didn't update the txt2 textbox .
 
i try that code under the itemid after update , then under the subform after update but it didn't update the txt2 textbox .
Like I said, you probably need to use Recalc, but I can't say for sure, since we can't see your form. Is txt2 bound to an expression? What is in its Control Source?
 
Like I said, you probably need to use Recalc, but I can't say for sure, since we can't see your form. Is txt2 bound to an expression? What is in its Control Source?
yes txt2 on the mainform , bound to an expression
 
Under whichever event you were using Requery.

PS. Just make sure you reference the control properly, i.e. use the proper syntax.
i try it , but it return to the firsr record on that sub form
 
txtT2 textbox is bound to this expression :
Code:
=CLng(nz(DSum("PriceOFSer";"OrderDetailTbl";"OrderNo=" & [OrderID] & " AND TitleServi=" & 2);0))
 
hii dears

on main form a textbox ( txt2 ) to gives me the total of subform some field
how to requery that textbox ( txt2 ) after user add new item on the sub form without return to the first record on the subform ?
Try:
Me.txt2.Form.Recalc
 
Try:
Me.txt2.Form.Recalc
plz understand me .
the txtT2 textbox is on the main form to gives me the total of a PriceService field on the subform .
what this code and under which event ?
 
wait , the subform is continuous , and i use keyboard arrows to move between its records , on that subfrm there combobox cboItemNo , i move to tha new record by using keybord arrows down to insert new record , when i use requery or recalc it jumps to the first record on that subform .
 
In the AfterUpdate event of the subform, you can recalc the main form control.

Unless you have a save button on the subform, the record you changed will not be updated until you move to a new subform record or back to the main form. That may be why you are not seeing the update immediately.
 

Users who are viewing this thread

Back
Top Bottom