Conditional Field, Need Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On a Form, I have a field called Actual Terminal and another field called
Other Terminal. Actual Terminal is a combo box with a drop down menu. I
want to make Other Terminal a required field if Other is chosed from the
Actual Terminal drop down. I know there have been other posts about this,
but I can't seem to make it work. Can someone please help me with the code?
And where to put the code?

Thanks,
Sylvia
 
In the form's BEFORE UPDATE event put something like...

If ActualTerminal = "other" then
If Isnull(OtherTerminal) Then
msgbox ("other terminal is required if actual terminal is other.")
me.OtherTerminal.setfocus
cancel
end if
end if


That is air code, not tested.
 
I get an error message:
Compile error: Method or data member not found

Then, when I click OK, I go back to the VB screen and see the following:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If ActualTerminal = "other" Then
If IsNull(OtherTerminal) Then
MsgBox ("other terminal is required if actual terminal is other.")
Me.OtherTerminal.SetFocus
Cancel

End If

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer) is highlighted in yellow and
Me.OtherTerminal is highlighted.

Help!!!
 
Oops! I had a space where it shouldn't have been. But now Cancel is
highlighted and I get the following error message:
Compile error: Expected Sub, Function or Property.

Not sure what that means???
 
Back
Top