expression in form

D

darren

I am using Access 2007

I have an expression (IIF statement) as a control source in a form that is
dependant on the data entered in an unbound text box in the same form. The
problem is when data is entered into the text box, the expression does not
automatically calculate. I have used a refresh button to overcome the problem
though am not satisfied with this.
 
S

Software-Matters

If the textbox determines the control source try something like this:

On the AfterUpdate of the text box:

If not isnull(me![TextBoxName]) then
[ControlName].ControlSource = me![TextBoxName]
me![ControName].Requery
end if

On the OnCurrent of the form:

If not isnull(me![TextBoxName]) then
[ControlName].ControlSource = me![TextBoxName] (or whatever you want)
end if

If this isn't what you are trying to achieve please let me know with an
explanation of what you are.
--
<a
href="http://www.software-matters.co.uk/bespoke-database-design.html">Bespoke
Access Database Development</a>
<p>Software Matters</br>
Straightforward solutions that work</p>
 
C

Chegu Tom

It looks like softwarematters is trying to change the control source for the
target control.

I think that darren had a calculation there that would calculate a value in
an unbound control (with iif(...........).

In that case all he needs is the me![controlname].requery in the
afterupdate event of the other textbox
 

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