PC Review


Reply
Thread Tools Rate Thread

AutoKeys feature and [Dirty] problem

 
 
slickdock
Guest
Posts: n/a
 
      14th Apr 2009
I put a macro icon on the toolbar that runs a macro with the condition that
if the current record is [Dirty], SaveRecord before continuing with the rest
of the macro.
It works fine when I initiate the macro by clicking the toolbar icon with
the mouse.

I assigned the macro to the F5 key by creating a macro called AutoKeys. But
when I try to access the macro by pressing F5, I get the message: "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."

Thanks in advance for any help.


 
Reply With Quote
 
 
 
 
slickdock
Guest
Posts: n/a
 
      15th Apr 2009
Can anyone help? I hope my question/problem is clear. I am using the
macroname AutoKeys to assign a macroname value when the user presses {F5}.

"slickdock" wrote:

> I put a macro icon on the toolbar that runs a macro with the condition that
> if the current record is [Dirty], SaveRecord before continuing with the rest
> of the macro.
> It works fine when I initiate the macro by clicking the toolbar icon with
> the mouse.
>
> I assigned the macro to the F5 key by creating a macro called AutoKeys. But
> when I try to access the macro by pressing F5, I get the message: "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."
>
> Thanks in advance for any help.
>
>

 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      16th Apr 2009
Slickdock,

Please let us know the details of the macro, i.e. actions and arguments, and
any Condition expressions. Thanks.

--
Steve Schapel, Microsoft Access MVP


"slickdock" <(E-Mail Removed)> wrote in message
news:5BD43E69-8652-438C-8B90-(E-Mail Removed)...
> Can anyone help? I hope my question/problem is clear. I am using the
> macroname AutoKeys to assign a macroname value when the user presses {F5}.
>
> "slickdock" wrote:
>
>> I put a macro icon on the toolbar that runs a macro with the condition
>> that
>> if the current record is [Dirty], SaveRecord before continuing with the
>> rest
>> of the macro.
>> It works fine when I initiate the macro by clicking the toolbar icon with
>> the mouse.
>>
>> I assigned the macro to the F5 key by creating a macro called AutoKeys.
>> But
>> when I try to access the macro by pressing F5, I get the message: "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."
>>
>> Thanks in advance for any help.
>>
>>

 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      16th Apr 2009
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.





"Steve Schapel" wrote:

> Slickdock,
>
> Please let us know the details of the macro, i.e. actions and arguments, and
> any Condition expressions. Thanks.
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "slickdock" <(E-Mail Removed)> wrote in message
> news:5BD43E69-8652-438C-8B90-(E-Mail Removed)...
> > Can anyone help? I hope my question/problem is clear. I am using the
> > macroname AutoKeys to assign a macroname value when the user presses {F5}.
> >
> > "slickdock" wrote:
> >
> >> I put a macro icon on the toolbar that runs a macro with the condition
> >> that
> >> if the current record is [Dirty], SaveRecord before continuing with the
> >> rest
> >> of the macro.
> >> It works fine when I initiate the macro by clicking the toolbar icon with
> >> the mouse.
> >>
> >> I assigned the macro to the F5 key by creating a macro called AutoKeys.
> >> But
> >> when I try to access the macro by pressing F5, I get the message: "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."
> >>
> >> Thanks in advance for any help.
> >>
> >>

>

 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      16th Apr 2009
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.



 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      16th Apr 2009
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.

>
>
>

 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      16th Apr 2009
Slickdock,

Ok, then try it like this...
[Screen].[ActiveForm].[Dirty]=True

--
Steve Schapel, Microsoft Access MVP


"slickdock" <(E-Mail Removed)> wrote in message
news:776AAE69-3A7D-4222-93B5-(E-Mail Removed)...
> 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?
>



 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      16th Apr 2009
Wow! You can DOOO that???? Thank you! Not only did it work, but I can use
that technique a LOT.

You've helped so much already. But, if you're up to it, do you know where
there may be a list of such ways to reference conditions?

"Steve Schapel" wrote:

> Slickdock,
>
> Ok, then try it like this...
> [Screen].[ActiveForm].[Dirty]=True
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "slickdock" <(E-Mail Removed)> wrote in message
> news:776AAE69-3A7D-4222-93B5-(E-Mail Removed)...
> > 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?
> >

>
>
>

 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      17th Apr 2009
Slickdock,

Happy to know that we've made progress.

I'm afraid I don't know of any documentation on this. If you go into the VB
Editor, and type Screen. then the Intellisense will show you some of the
options available, and many of these will be available also for use in macro
conditions.

--
Steve Schapel, Microsoft Access MVP


"slickdock" <(E-Mail Removed)> wrote in message
news:914C3F28-61AF-46EF-A5D5-(E-Mail Removed)...
> Wow! You can DOOO that???? Thank you! Not only did it work, but I can use
> that technique a LOT.
>
> You've helped so much already. But, if you're up to it, do you know where
> there may be a list of such ways to reference conditions?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dirty, dirty ********* the X-rated picture guide Abarbarian General Discussion 0 25th Mar 2010 10:17 PM
AutoKeys Enter Keystroke Problem jutlaux Microsoft Access Macros 0 7th Jan 2009 03:52 PM
excel sheet dirty read and dirty write? DAXU Microsoft Excel Programming 6 21st Feb 2008 12:03 PM
Autokeys macro: how can you get the "normal" access key behaviour after the autokeys routine A C Microsoft Access Macros 1 25th Nov 2005 07:59 AM
detecting that a dirty form is no longer dirty Microsoft Access Form Coding 8 11th Aug 2004 11:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:52 AM.