Function using Dirty property in Text Box not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this expression in a text box control on a form:
=IfDirty([Form]) & [Form].[Dirty]
where IfDirty([Form]) activates an OK and Cancel button on the form.

I also have another text box control with only =[Form].[Dirty] inside to
check if the dirty property changes.

This works fine in my own computer but not when distributed with the Runtime
Access 2002. In both cases, I can see that the dirty property changes from 0
to -1 when I change something on the form. But the IfDirty() function is not
run.

I also have a similar problem with a function which I use in the
ValidationRule property in another text box on another form in the same
application. I get the error message '...The function you entered can't be
used in this expression.'

Although both functions are located in the form's own module, it seems that
Access cannot find them.

Thanks
/Lars
 
IfDirty() is not a built-in function, so you are relying on somebody's code.
There is a Dirty event in Access 2002, so use that instead.

There were various attempts to write code to simulate a Form_Dirty event,
but none of them that I saw ever worked 100%.
 
Thanks Allen,

I have considered using the On Dirty event instead, but I am worried about
this problem not only because of the IfDirty() function but also about
possible problems with other functions used in text boxes in this way in my
application. This problem first appeared when rewriting my application from
mdb to access project (adp/ade) files. The problem does not always appear in
the runtime environment but I cannot find out what is different from time to
time.

/Lars

Allen Browne said:
IfDirty() is not a built-in function, so you are relying on somebody's code.
There is a Dirty event in Access 2002, so use that instead.

There were various attempts to write code to simulate a Form_Dirty event,
but none of them that I saw ever worked 100%.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
lars said:
I have this expression in a text box control on a form:
=IfDirty([Form]) & [Form].[Dirty]
where IfDirty([Form]) activates an OK and Cancel button on the form.

I also have another text box control with only =[Form].[Dirty] inside to
check if the dirty property changes.

This works fine in my own computer but not when distributed with the
Runtime
Access 2002. In both cases, I can see that the dirty property changes
from 0
to -1 when I change something on the form. But the IfDirty() function is
not
run.

I also have a similar problem with a function which I use in the
ValidationRule property in another text box on another form in the same
application. I get the error message '...The function you entered can't be
used in this expression.'

Although both functions are located in the form's own module, it seems
that
Access cannot find them.

Thanks
/Lars
 
I finally managed to solve the problem by uninstalling and reinstalling the
MDAC-package. I seems that a missing reference creates unexpected effects
although that it is not at all involved in the code affected. The problem
with MDAC 2.8 package was that it did not update certain files remaining from
an older version of MDAC.

/Lars


lars said:
Thanks Allen,

I have considered using the On Dirty event instead, but I am worried about
this problem not only because of the IfDirty() function but also about
possible problems with other functions used in text boxes in this way in my
application. This problem first appeared when rewriting my application from
mdb to access project (adp/ade) files. The problem does not always appear in
the runtime environment but I cannot find out what is different from time to
time.

/Lars

Allen Browne said:
IfDirty() is not a built-in function, so you are relying on somebody's code.
There is a Dirty event in Access 2002, so use that instead.

There were various attempts to write code to simulate a Form_Dirty event,
but none of them that I saw ever worked 100%.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
lars said:
I have this expression in a text box control on a form:
=IfDirty([Form]) & [Form].[Dirty]
where IfDirty([Form]) activates an OK and Cancel button on the form.

I also have another text box control with only =[Form].[Dirty] inside to
check if the dirty property changes.

This works fine in my own computer but not when distributed with the
Runtime
Access 2002. In both cases, I can see that the dirty property changes
from 0
to -1 when I change something on the form. But the IfDirty() function is
not
run.

I also have a similar problem with a function which I use in the
ValidationRule property in another text box on another form in the same
application. I get the error message '...The function you entered can't be
used in this expression.'

Although both functions are located in the form's own module, it seems
that
Access cannot find them.

Thanks
/Lars
 
Back
Top