Calulating "on the fly"

K

Ken

I have a form that I want to set a text box so I can use it to sort on.

I tried to set the Me.orderby = "txtbox" but this resulted in an error.

I then tried to set the orderby using the field name:
Me.orderby = "field1, field2, field2"
and this worked.

Next I tried to set the text box to show what the sort order was.
me.txtbox.controlsource = "[field1] & " " & [field2] & " " & [field3]"
This gives me a #error in the text box until I click on the form and scroll
down.

I can not get the form to refresh or update the information in the text box.

Any ideas?
 
F

fredg

I have a form that I want to set a text box so I can use it to sort on.

I tried to set the Me.orderby = "txtbox" but this resulted in an error.

I then tried to set the orderby using the field name:
Me.orderby = "field1, field2, field2"
and this worked.

Next I tried to set the text box to show what the sort order was.
me.txtbox.controlsource = "[field1] & " " & [field2] & " " & [field3]"
This gives me a #error in the text box until I click on the form and scroll
down.

I can not get the form to refresh or update the information in the text box.

Any ideas?

No need for VBA code.
Set the control source of an unbound control on your form to:

=forms!ThisFormName.Orderby
 
Top