Error message on field

P

Pammy

I have a field called Latent Case Type, if this is filled in then I want the
user to have to fill in a field called Comparison Type, if they do not, then
I want an error message to pop up telling them they have to fill out the
Comparison Type, but if nothing is filled out in the Latent Case Type then
they do not have to fill in the Comparison Type. Is there an easy way to do
this? I do not want them to be able to leave this form if the field has to
be filled in.

Thanks,
 
T

Tom van Stiphout

On Wed, 25 Jun 2008 05:55:02 -0700, Pammy

Yes. Write your code in the Form_BeforeUpdate event:
if not isnull(Me.[Latent Case Type]) then
if IsNull(Me.[Comparison Type]) then
Msgbox "Yo! Fill out the Comparison Type!"
Cancel = True
end if
end if

Note the use of "Cancel=True" which will keep the user on the current
record until the condition is satisfied.

-Tom.
 
B

Beetle

In the before update event of your form;

Private Sub Form_BeforeUpdate (Cancel As Integer)

If Not IsNull(Me![Latent Case Type]) Then
If IsNull (Me![Comparison Type]) Then
MsgBox "You must enter a Comparison Type"
Cancel = True
End If
End If

End Sub
 
P

Pammy

Another question:

Is there a way for the field called Latent Case Type when something is
selected from the drop-down fill in automatically the field called Comparison
Type whith the selection "Identification Made" from the drop-down.
If nothing is filled out in the Latent Case Type then they can choose
whatever they want in the Comparison Type drop-down list.

Tom van Stiphout said:
On Wed, 25 Jun 2008 05:55:02 -0700, Pammy

Yes. Write your code in the Form_BeforeUpdate event:
if not isnull(Me.[Latent Case Type]) then
if IsNull(Me.[Comparison Type]) then
Msgbox "Yo! Fill out the Comparison Type!"
Cancel = True
end if
end if

Note the use of "Cancel=True" which will keep the user on the current
record until the condition is satisfied.

-Tom.

I have a field called Latent Case Type, if this is filled in then I want the
user to have to fill in a field called Comparison Type, if they do not, then
I want an error message to pop up telling them they have to fill out the
Comparison Type, but if nothing is filled out in the Latent Case Type then
they do not have to fill in the Comparison Type. Is there an easy way to do
this? I do not want them to be able to leave this form if the field has to
be filled in.

Thanks,
 
T

Tom van Stiphout

On Wed, 25 Jun 2008 07:35:01 -0700, Pammy

Sure. Write your code in the AfterUpdate event of the first dropdown.
Something like:
Me.SecondDropdown.Value = TheIDvalueForIdentificationMade

(I am assuming a standard bound dropdown2 with a hidden ID column and
a visible Description column)

-Tom.

Another question:

Is there a way for the field called Latent Case Type when something is
selected from the drop-down fill in automatically the field called Comparison
Type whith the selection "Identification Made" from the drop-down.
If nothing is filled out in the Latent Case Type then they can choose
whatever they want in the Comparison Type drop-down list.

Tom van Stiphout said:
On Wed, 25 Jun 2008 05:55:02 -0700, Pammy

Yes. Write your code in the Form_BeforeUpdate event:
if not isnull(Me.[Latent Case Type]) then
if IsNull(Me.[Comparison Type]) then
Msgbox "Yo! Fill out the Comparison Type!"
Cancel = True
end if
end if

Note the use of "Cancel=True" which will keep the user on the current
record until the condition is satisfied.

-Tom.

I have a field called Latent Case Type, if this is filled in then I want the
user to have to fill in a field called Comparison Type, if they do not, then
I want an error message to pop up telling them they have to fill out the
Comparison Type, but if nothing is filled out in the Latent Case Type then
they do not have to fill in the Comparison Type. Is there an easy way to do
this? I do not want them to be able to leave this form if the field has to
be filled in.

Thanks,
 
Top