Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78

    Unanswered: Continuous Forms (Mandatory Field)

    I have a continuous form with a couple of fields. I need to find a way to make field 2 mandatory depending on the value in field 1.

    For example if field 1 contains A, B or D, field 2 needs to remain not mandatory. If field one contains C I need field 2 to be mandatory.

    Is ther a fairly easy way to do this?

    Thank you.

  2. #2
    Join Date
    Oct 2009
    Posts
    340
    No problem. In the 'AfterUpdate' of the first textbox control you are going to enter logic to do this. Possibly an If/then statement or Case. Not sure if you want to then use a msgbox or what - - so the management of the user experience will dictate what coding you implement. But this is the general idea.

    Hope it helps.
    www CahabaData com

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
     If Me.Field1 = "C" And Nz(Me.Field2, "") = "" Then
      MsgBox "Field2 Must be filled in!"
      Cancel = True
      Field2.SetFocus
     End If
    End Sub
    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •