msgbox on close of form

msgbox on close of form

Post by TWFhe » Sat, 09 Jun 2007 02:25:03


hello all, i would like a form to pop up with a msgbox that states "BOM or
Labour is at zero value". The form would simply stay open until the BOM,
Labour or Status is changed.
the msgbox would only appear if STATUS = "engineered" and BOM is "0" or
LABOUR is "0"

I thought the routine would be something like,

If [status] = "engineered" and isnull ([BOM]) or isnull ([LABOUR]) then
msgbox "BOM or LABOUR are at zero value"

Erm i know my terminology is all wrong and i need a bit more but hoped that
this would help indicate my intentions?

any help appreciated.
 
 
 

msgbox on close of form

Post by TWFhe » Sat, 09 Jun 2007 02:55:00

Hello all (sorry if this post appears twice, i already sent a post but it has
not showed up in the group)

I want a msgbox to appear on the close of the form if the following is true,

[status] = "engineered" and [bom] = "0"
or
[status] = "engineered" and [labour] ="0"

the form should stay open until one of the above states changes.

any help appreciated

 
 
 

msgbox on close of form

Post by Carl Rapso » Sat, 09 Jun 2007 03:50:56


In the Form_Unload event:

If (Me.[status]="engineered") And ((Me.[bom]="0") Or (Me.[labour]="0")) Then
MsgBox "Your message here"
Cancel = True
End If

Carl Rapson
 
 
 

msgbox on close of form

Post by TWFhe » Sat, 09 Jun 2007 09:58:00

Hi Carl, unfortunately the code you supplied does not seem to do anything.
When i click close form the form closes regardless of the status, bom and
labour.
I dont get any messages or errors, just nothing?
 
 
 

msgbox on close of form

Post by Carl Rapso » Sat, 09 Jun 2007 23:38:01

If you put a breakpoint in the If... line, do you ever reach it? In other
words, is the Form_Unload event firing? Also, you might try using the names
of the form controls instead of the field names in the If statement.

Carl Rapson