Message Box for Form

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a form named FEmpTotHours with a sub-form on it named
PayrollCheck
When the sub-form control named CheckNo has a value in it, (a
number) I would like for a message box to open
and say Check Has Already Been Printed.

How can I do this?

Thanks,

Dave
 
try

If Not IsNull(CheckNo) Then
MsgBox "Check Has Already Been Printed"
End If

attach the code to whatever event that you want to trigger the message.

hth
 
This code does not refer to the sub-form and so it wont work. What can I do?
It shows the message box even when there are no checks with a value in
(ChkNo).
 
to give a more specific answer, i need more detail. the CheckNo control is
on a subform, i got that from your first post. but do you want the code to
be triggered from the main form? or from within the subform? how are you
triggering the code, by a control's AfterUpdate event? by a form's
BeforeUpdate event? from a command button? you need to explain what you're
doing in the form, and at what point in the process you need to see the
message.
 
The code is being triggered by the main form right now ON LOAD Event
I need to see the Messabe Box Before the Main form Loads as a Reminder.

Thanks,
 
try

If Not IsNull(Me!SubformCONTROLName!CheckNo) Then
MsgBox "Check Has Already Been Printed"
End If

make sure you use the subform control name, not the subform name - they may
be the same, or may be different. to get the control name, open the main
form in design view. click once on the subform to highlight it *in the main
form*. in the Properties box, click the Other tab and look at the Name
property. that's the subform control name.

hth
 
That code freaked out the form with errors.
tina said:
try

If Not IsNull(Me!SubformCONTROLName!CheckNo) Then
MsgBox "Check Has Already Been Printed"
End If

make sure you use the subform control name, not the subform name - they may
be the same, or may be different. to get the control name, open the main
form in design view. click once on the subform to highlight it *in the main
form*. in the Properties box, click the Other tab and look at the Name
property. that's the subform control name.

hth


control code can
 
I believe it is something like this, but my syntax is wrong.

If Not IsNull "[Forms]![FEmpTotHours].[Payroll Check].Form![CheckNo]" Then
MsgBox "Some Checks Have Already Been Printed"
End If
 
that's not very informative; if you want detailed help, give detailed
information. what exact error codes and text, and when did they occur? and
in what order?
 
use the IsNull() function as demonstrated in my previous post. as for the
syntax of the field reference, usually when you're running code from within
the main form, you don't have to reference the subform's Form property -
unless you're manipulating a specific form property of the subform such as
Filter or Requery. but if it takes the full reference to make it work in
this instance, that's fine.


Dave Elliott said:
I believe it is something like this, but my syntax is wrong.

If Not IsNull "[Forms]![FEmpTotHours].[Payroll Check].Form![CheckNo]" Then
MsgBox "Some Checks Have Already Been Printed"
End If


Dave Elliott said:
That code freaked out the form with errors.
they
may are
you see
the What
can value
value
 
Back
Top