NILKAMAL


hi!

i create simple form with table field and i create another two textbox in sam form (which is not table field) when i go to next record the table field got refresh but other two textbox have same value of previous record so can anybody tell me how do i do to refresh all field including textbox( not table field)

thanks




Re: refresh form

Naomi Nosonovsky


How do you set values for the unbound textboxes Do you use some form's method to update value in these textboxes based on the value in the field in a table If yes, then you should call this method right after you called thisform.refresh().




Re: refresh form

NILKAMAL

thanks for reply

unbound textboxex value gotfocus from table field a and table field b now when i click next button it will refresh table fied a and b not a unbound textbox

please help me

thanx






Re: refresh form

Naomi Nosonovsky

I don't think you can make it work using GotFocus method of unbound textboxes. I think you need to re-think your approach. In your other thread on this topic I suggested to create a form's method to update values in unbound textboxes. This method you can call from various places: from bound textbox.valid, from form's Refresh method, etc. Now you should be able to see the benefits of the idea of having a separate method.



Re: refresh form

dni

Yuu may try thisform.Refresh after values are changed and you press next button or refresh each textbox individualy, thisform.textboxname.Refresh.






Re: refresh form

NILKAMAL

sorry

no luck

thanks for reply





Re: refresh form

Naomi Nosonovsky

What exactly is the problem and how do you set value for these unbound textboxes



Re: refresh form

AndyKr

>> when i go to next record the table field got refresh but other two textbox have same value of previous record so can anybody tell me how do i do to refresh all field including textbox( not table field)

There is no way "refresh" an textbox unless it IS bound. Refresh means "update the control's value from its source". If the control is not bound it has no source from which to read the value and so it cannot be 'updated'.

What you need to do is re-calculate the textbox's value when OTHER controls are refreshed.

For example. Suppose you have three text boxes on a form:

[1] "txtCost" is bound to a field in a table that sotres a cost value.

[2] "txtQty" is bound to another field that stores the number of items.

[3] "txtPrice" is NOT bound but you want it to show the cost.

The simplest method (though not the best) is to add code to the Refresh() event of txtPrice like this:

This.Value = ThisForm.txtCost.value * ThisForm.txtQty.Value

A better method is to add a custom method to the form that is called from the FORM.REFRESH() like this:

ThisForm.UpdateValues()

Now in your UpdateValues method you can handle all controls that need to be updated when the form is refreshed, not just one. So your could in that method would be:

WITH ThisForm

.txtPrice.Value = .TxtCost.Value * .txtQty.value

*** Other controls here

ENDWITH






Re: refresh form

NILKAMAL

thanks for reply

but still didn't work

my two field (from table) will refresh when i click next button but the total field (not from table , toatl = fielda+fieldB) not refresh

thanks





Re: refresh form

dni

Whwn you need to refresh toatl before or after press next button




Re: refresh form

NILKAMAL

thanks for reply

i need refresh after i click next button

thanks





Re: refresh form

dni

Then in click method of next button you may add:

thisform.textc.Value = thisform.texta.Value + thisform.textb.Value

or thisform.textc.Value = fielda + fieldb && fielda and fieldb from database

if is not refreshing add:

thisfoem.textc.Refresh






Re: refresh form

Naomi Nosonovsky

What code do you call from the Next button

If you're calling thisform.Refresh()

try to add the following into the form's Refresh method

dodefault() && May be unnecessary

thisform.UpdateValues()

In UpdateValues method you would set values of unbound textboxes to the calculated values based on table's fields.





Re: refresh form

dni

In next button at click method you may put:

thisform.txtC.Value = thisform.txtA.Value + thisform.txtB.Value or

if you take fields direct from table

thisform.txtC.Value = fieldA + fieldB

If is not refreshing you may use:

thisform.txtC.Refresh






Re: refresh form

Naomi Nosonovsky

Where did all replies go Call a method to refresh unbound textboxes from thisform.refresh()

Now I finally see all replies, but for several hours I saw only few replies and nothing new. Wondering if this was problem only at my site.