Set form dirty through unbound control

T

twinkler

Dear all,

I have an unbound listbox (multiselect) on a bound form.
The listbox and its selection are populated via vba from a table.

I have an invisible helper txt field which is bound to a table.

The helper txt receives whatever is selected in the listbox by setting
its value property to the list box elements.

Unfortunately this does not make the form dirty. Apparently changing
the value property of a txt field does not trigger the dirty event but
only changing the text property of a text field does.

I can not set the text value of my little helper txt field because it
has to have focus and for getting focus it has to be visible.

Is there a way to make the form dirty via VBA from the listbox? Can I
somehow trigger the event?

I tried to set the text property of a visible bound text field
( Me.txtAlias.Text = Me.txtAlias.Text ) but I am getting a run time
error 2115 - macro or function set to beforeupdate or validation rule
is preventing the application from saving data into the field. Even
though I positively to not have beforeUpdate of Validation rules on
txtAlias...

Any help is appreciated

Cheers

Torsten
 
M

Marshall Barton

twinkler said:
I have an unbound listbox (multiselect) on a bound form.
The listbox and its selection are populated via vba from a table.

I have an invisible helper txt field which is bound to a table.

The helper txt receives whatever is selected in the listbox by setting
its value property to the list box elements.

Unfortunately this does not make the form dirty. Apparently changing
the value property of a txt field does not trigger the dirty event but
only changing the text property of a text field does.

I can not set the text value of my little helper txt field because it
has to have focus and for getting focus it has to be visible.

Is there a way to make the form dirty via VBA from the listbox? Can I
somehow trigger the event?

I tried to set the text property of a visible bound text field
( Me.txtAlias.Text = Me.txtAlias.Text ) but I am getting a run time
error 2115 - macro or function set to beforeupdate or validation rule
is preventing the application from saving data into the field. Even
though I positively to not have beforeUpdate of Validation rules on
txtAlias...


Events are not triggered by code stting a control's value.
(The Dirty property will be set though.)

However, that's not a serious issue because you can call any
procedure in your code. To call the Dirty event procedure,
use:
Form_Dirty dummy
 
T

twinkler

Events are not triggered by code stting a control's value.
(The Dirty property will be set though.)

However, that's not a serious issue because you can call any
procedure in your code. To call the Dirty event procedure,
use:
Form_Dirty dummy

Thanks heaps Marsh, your suggestion works!

Cheers

Torsten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top