Required?

  • Thread starter Thread starter Kerry
  • Start date Start date
K

Kerry

Hi

I have three fields:-
Type (1 character + or -)
Bought (currency)
Sold (currency).

If the value entered in the type field is + then I would
like the bought field to be required = yes, if the value
in the type field is - then I would like the sold field
to be required=yes.

How can I do this?

Many Thanks

Kerry
 
Hi Kerry....

I am assuming a bunch of things here, so you will have to modify this.....

If [type]="+" Then
Me.bought.SetFocus
Else If [type] = "-" Then
Me.sold.SetFocus
Else
MsgBox "Please enter a value in Type"
End If


Then in you properties for the bought and sold textboxes, put in the On_Exit
event:

If [bought] <= 0 then
MsgBox "You must enter an amount"
Me.bought.SetFocus
End If
Exit Sub

This is were you check that the user actually entered an amount. Again, I am
assuming things here, so you will have to modify the code to suit your data
types.

HTH
 
Back
Top