Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2006
    Posts
    110

    Question Unanswered: Field exit question

    Hello All, I have a question, when I am using the record navagation buttons on my form, going from record 1 to 2, then back to 1, these fields set below are closing, even if my control "event" criteria doesnt match what im telling it to close.

    Is this a problem with my form, or Me.Event field? I am on single form, and I only have it to close on EVENT_Exit field.


    Private Sub EVENT_Exit(Cancel As Integer)
    If Me.EVENT = "MARRIAGE" Then
    Me.TOTAL_DIV_ENC.Enabled = False
    Me.DIV_AMEND.Enabled = False
    Me.MARR_ANNUL.Enabled = False
    Me.SEP_MAINT.Enabled = False
    End If
    If Me.EVENT = "DIVORCE" Then
    Me.TOTAL_MARR_ENC.Enabled = False
    Me.MARR_AMEND.Enabled = False
    End If

    Ive searched, but to no avail.. could someone guide me in the right direction on this?

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I'm not sure I'm understanding what you want to happen, but try adding that code to the current event of the form.
    Paul

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    It sounds like you're wanting to Enable/Disable certain controls when you exit the EVENT field. The problem is Event_Exit only triggers if you actually exit the field i.e. Tab out or click on another field. It doesn't trigger if you move to another record using the nav buttons. I think Paul's idea is correct and will give you the results you want if you move to another record and then back, but I think you also need to leave the code in the Event_Exit sub as well, if you ever want to exit the field but stay in the record.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Oct 2006
    Posts
    110

    Thumbs up

    Ive fixed it!! I had to add the part below, but I didnt think it would close fields, since I only had it on if the event changed.. I didnt have code anywhere else to close those amount fields.

    Thanks for your help!

    Private Sub Form_Current()
    'added this part
    Me.TOTAL_DIV_ENC.Enabled = True
    Me.DIV_AMEND.Enabled = True
    Me.MARR_ANNUL.Enabled = True
    Me.SEP_MAINT.Enabled = True
    Me.TOTAL_MARR_ENC.Enabled = True
    Me.MARR_AMEND.Enabled = True
    '

    If Me.Event2 = "MARRIAGE" Then
    Me.TOTAL_DIV_ENC.Enabled = False
    Me.DIV_AMEND.Enabled = False
    Me.MARR_ANNUL.Enabled = False
    Me.SEP_MAINT.Enabled = False
    End If
    If Me.Event2 = "DIVORCE" Then
    Me.TOTAL_MARR_ENC.Enabled = False
    Me.MARR_AMEND.Enabled = False
    End If
    End Sub

Posting Permissions

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