PC Review


Reply
Thread Tools Rate Thread

Conditional Macro Message Box on a Form

 
 
Sarah G
Guest
Posts: n/a
 
      23rd Oct 2008
I am have set a message box on a form but only want it to display if the
entry in the number field is >120.
I assume I need to put this macro in the On Update line in Properties but am
unsure of how to write the expression. I have used basic expressions before
but never one that included a macro
If Weight >120 run macro "weight"
Hope you can help
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      24th Oct 2008
On Thu, 23 Oct 2008 15:42:01 -0700, Sarah G wrote:

> I am have set a message box on a form but only want it to display if the
> entry in the number field is >120.
> I assume I need to put this macro in the On Update line in Properties but am
> unsure of how to write the expression. I have used basic expressions before
> but never one that included a macro
> If Weight >120 run macro "weight"
> Hope you can help


There is no On Update property. There is an AfterUpdate property.

On the [NumberField] property sheet, select the Event tab.
On the AfterUpdate event line write
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.

Between those 2 lines, write

If Me![NumberField] >120 then
MsgBox "Place your message here."
End If

Change [NumberField] to the actual name of the control on your form.
Exit the code window.

You can substitute the actual message of your current macro message
box, but that's all you need. You do not need your macro.



--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
 
 
 
Sarah G
Guest
Posts: n/a
 
      24th Oct 2008
.. Yes I meant After Update but I'm glad you knew what I meant. That has
worked well. Thank you so much

"fredg" wrote:

> On Thu, 23 Oct 2008 15:42:01 -0700, Sarah G wrote:
>
> > I am have set a message box on a form but only want it to display if the
> > entry in the number field is >120.
> > I assume I need to put this macro in the On Update line in Properties but am
> > unsure of how to write the expression. I have used basic expressions before
> > but never one that included a macro
> > If Weight >120 run macro "weight"
> > Hope you can help

>
> There is no On Update property. There is an AfterUpdate property.
>
> On the [NumberField] property sheet, select the Event tab.
> On the AfterUpdate event line write
> [Event Procedure]
> Then click on the little button with the 3 dots that appears on that
> line.
> When the code window opens, the cursor will be flashing between 2
> already existing lines of code.
>
> Between those 2 lines, write
>
> If Me![NumberField] >120 then
> MsgBox "Place your message here."
> End If
>
> Change [NumberField] to the actual name of the control on your form.
> Exit the code window.
>
> You can substitute the actual message of your current macro message
> box, but that's all you need. You do not need your macro.
>
>
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
>

 
Reply With Quote
 
Dan Knight
Guest
Posts: n/a
 
      24th Oct 2008
Sarah,
Depending on your needs ie: the weight macro message, you might be better
off putting the code in the BeforeUpdate event. This will allow you to
Cancel=True & Me.Undo to reverse the errant data.

the AfterUpdate event occurs, as it's name After the data has been updated.
The BeforeUpdate allows you to test the data value and then reject it IF it
doesn't meet criteria.

Again, just a thought that may or may not be applicable for your purposes.

--
Dan Knight



"Sarah G" wrote:

> . Yes I meant After Update but I'm glad you knew what I meant. That has
> worked well. Thank you so much
>
> "fredg" wrote:
>
> > On Thu, 23 Oct 2008 15:42:01 -0700, Sarah G wrote:
> >
> > > I am have set a message box on a form but only want it to display if the
> > > entry in the number field is >120.
> > > I assume I need to put this macro in the On Update line in Properties but am
> > > unsure of how to write the expression. I have used basic expressions before
> > > but never one that included a macro
> > > If Weight >120 run macro "weight"
> > > Hope you can help

> >
> > There is no On Update property. There is an AfterUpdate property.
> >
> > On the [NumberField] property sheet, select the Event tab.
> > On the AfterUpdate event line write
> > [Event Procedure]
> > Then click on the little button with the 3 dots that appears on that
> > line.
> > When the code window opens, the cursor will be flashing between 2
> > already existing lines of code.
> >
> > Between those 2 lines, write
> >
> > If Me![NumberField] >120 then
> > MsgBox "Place your message here."
> > End If
> >
> > Change [NumberField] to the actual name of the control on your form.
> > Exit the code window.
> >
> > You can substitute the actual message of your current macro message
> > box, but that's all you need. You do not need your macro.
> >
> >
> >
> > --
> > Fred
> > Please respond only to this newsgroup.
> > I do not reply to personal e-mail
> >

 
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
msg box - remove check box or keep check box in form JamiOrtung Microsoft Access Form Coding 1 22nd Sep 2009 09:59 PM
open message box before the update or dont update message box open Jay Microsoft Excel Programming 2 25th Jun 2009 05:42 PM
Error Message: Windows cannot find 'box,box,box,box,box' =?Utf-8?B?Ym91Y2hhcmRwaWU=?= Windows XP Help 2 25th Jul 2005 08:47 PM
Re: Conditional Message Box with a Macro... Steve Schapel Microsoft Access Macros 1 20th Jul 2004 09:06 PM
When I try to open Control Panel\"Add/remove programs", I get the message shown in the subject line of this message posting. When I then get in "Add/remove programs", I cannot uncheck box next to "Message Queuing" in Con =?Utf-8?B?cGJhZXJ3YWxk?= Windows XP Help 2 14th Jan 2004 04:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 AM.