Thank you. I used to have a simple SaveRecord command instead of the dirty
condition. But the harm in running SaveRecord if its not dirty is when users
with ReadOnly rights are trying to use the database. They get an error if
SaveRecord is part of the command, and they don't have rights to save the
record. That's why I changed it to if Dirty. Since ReadOnly users are never
dirty, the dirty line is ignored by them.
The problem with fully referencing the form name is that the macro may be
initiated at any time, anywhere. So one of 20 or more forms could be
currently open when the macro is initiated. That's why I didn't already solve
the problem by fully referencing the form name in the "dirty" argument.
Any other thoughts?
"Steve Schapel" wrote:
> Slickdock,
>
> I have never used this type of construct, so I am not sure. But I think you
> would need to change the Condition to something like:
> [Forms]![NameOfYourForm].[Dirty]=True
>
> However, the easiest solution might be to just remove the Condition anyway.
> It won't do any harm to try and run a SaveRecord even if the record is not
> dirty.
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "slickdock" <(E-Mail Removed)> wrote in message
> news:CE1AEFC3-C804-4431-A3F9-(E-Mail Removed)...
> > Thank you. The macro is called mOpenForm.DA:
> >
> > 1) Condition: [Dirty]
> > Action: RunCommand, SaveRecord
> > 2) OpenForm: DA, Data Mode: Edit, Window Mode: Normal
> >
> > When I click with the mouse on the toolbar, it runs fine.
> >
> > When I press {F5}, it runs macro AutoKeys, which is:
> >
> > 1) MacroName: {F5}
> > Action: RunMacro, Macro Name: mOpenForm.DA
> >
> > When I press {F5} to execute the macro, I get the error message:
> > "DBname can't find the name 'Dirty' you entered in the expression.
> > You may have specified a control that wasn't on the current object without
> > specifying the correct for or report context."
> >
> > So it's like it doesn't recognize that there is a form currently open if I
> > use {F5}, but it DOES recognize that there is a form open if I use the
> > mouse
> > to click the icon on the toolbar.
>
>
>
|