Dirty Me

G

Guest

On an unbound form, where I assign values from another form, does dirty fire
when changes are made? Will it fire for the form or just the field that has
been changed? And how can I check this if it does go off because, If
me.form.dirty = true gives me an error, specifically that the expression is
an invalid reference to the property dirty. Thanks for your help.
 
D

Dirk Goldgar

In
Michael Conroy said:
On an unbound form, where I assign values from another form, does
dirty fire when changes are made? Will it fire for the form or just
the field that has been changed? And how can I check this if it does
go off because, If me.form.dirty = true gives me an error,
specifically that the expression is an invalid reference to the
property dirty. Thanks for your help.

The Dirty event doesn't fire for unbound forms, and I don't believe it
fires for unbound controls even on a bound form. Also, the Dirty event
of a control doesn't fire when you assign to its Value property in code,
though the help file says it will fire if you assign to the control's
Text property.

If you're assigning values to the form's controls using VBA code, you
can have that code call a public procedure on the form to let it know
that a value has been changed.
 
G

Guest

Hi Michael,

If you want to test to see if the current form (read: the form whose module
you are adding code to) is dirty, it's:

If Me.Dirty Then

It's not: If Me.Form.Dirty Then

The Me is a shorthand reference to the current form. The longer reference,
assumming the form is open, would be Forms!FormName

There is a 'Form' porperty, but I can't recall using it other than to refer
to a subform as in: Forms!MyForm!MySubFormControlName.Form.Requery

Hope that helps,
CW
 
D

Dirk Goldgar

In
Cheese_whiz said:
Hi Michael,

If you want to test to see if the current form (read: the form whose
module you are adding code to) is dirty, it's:

If Me.Dirty Then

But the Dirty property may only be used on a bound form. As Michael
pointed out in his original post, testing that property on an unbound
form raises an error. That's why he posted the question.
It's not: If Me.Form.Dirty Then

Me.Form.Dirty is valid, although redundant. "Me", when used in a form's
code module, is a reference to that form. The form also has a "Form"
property, which returns a reference to the form itself. So practically
speaking,

Me.Dirty

and

Me.Form.Dirty

are equivalent.
 
G

Guest

Thanks for clarifying that, Dirk. I should have tested it first before I
posted it. I knew there was a chance it could be redundant, yet not wrong.
But the Dirty property may only be used on a bound form. As Michael
pointed out in his original post, testing that property on an unbound
form raises an error. That's why he posted the question.

That's true. I guess I figured it would be ok to point out what I saw (and
still do, frankly) as a small syntax issue. Maybe I was mistaken twice.

CW



Thanks again for
 
T

Tom Wussernark [MSFT]

you're mistaken for using unbound forms

you don't need unbound forms

you need a reliable efficient database server


move to ADP, kid


btw; is your name jesse?
 
T

Tony Toews [MVP]

Tom Wussernark said:
you're mistaken for using unbound forms

you don't need unbound forms

you need a reliable efficient database server


move to ADP, kid

Note that this person is really A a r o n K e m p f and that he is not an employee
of Microsoft.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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

Similar Threads


Top