Code for Message

K

K

Good day,

how do I code that if a field is empty (Null) then to run a macro.

Here is what I am trying to do,

In a subform I have a dropdown menu (Combo box) that has different machines.
Certain information is required inorder to calculate a rate. Basically, If
the user selects a machine and one of the fields is empty a message box comes
up saying "Incomplete information" otherwise if all the information is there
then it does the caculation.

Hope that makes sense.,

Thanks for your help in advance

Cheers
 
D

Damian S

Hi K,

In the after update event of the combo box, have code similar to the
following:

if isnull(me.FIELD1) OR isnull(me.FIELD2) then
msgbox "Incomplete information"
else
CODE TO CALCULATE RATE
endif

where FIELD1 and FIELD2 are fields that can't be null, and the code to
calculate rate is placed in there.

Hope this helps.

Damian.
 
K

K

Damian.

Thanks! much appreciated.

Cheers
Kyle.

Damian S said:
Hi K,

In the after update event of the combo box, have code similar to the
following:

if isnull(me.FIELD1) OR isnull(me.FIELD2) then
msgbox "Incomplete information"
else
CODE TO CALCULATE RATE
endif

where FIELD1 and FIELD2 are fields that can't be null, and the code to
calculate rate is placed in there.

Hope this helps.

Damian.
 
K

K

Not working here is my code

Private Sub UOM_LostFocus()
IIf [PIECES] = 0, MsgBox("Incomplete Information. Number of PCS/CUT Required
for this process"), PCS_HR = 1


End Sub
 
Top