Results 1 to 6 of 6
  1. #1
    lrmcmor is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    3

    How to refresh form for conditionally enabling a field?

    I have seen similar threads to what I am trying to do, but nothing exact. I am trying to enable one field based on the value from a combo box. I can get the logic to work, but only if the record is saved or if I hit the Refresh All button on the ribbon bar. My situation is that the data is not yet saved to the database.



    My details are:

    ItemFrom = Name of Combo box
    LitType = Name of field to be conditionally enabled based on value from ItemFrom
    Litigation = value from ItemFrom combo box for conditional enabling to be activated

    I have the following EventProcedure set at the form level

    On Current
    Private Sub Form_Current()
    If Me.ItemFrom = "Litigation" Then
    Me.LitType.Enabled = True
    Else
    Me.LitType.Enabled = False
    End If
    End Sub

    Again, I can get the action I want IF I press RefreshAll. I have tried to set a me.refresh in other event procedures for both the ItemFrom and LitType fields...but I cannot get the refresh I want.
    PLEASE HELP!!!!!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Try the code you have in the After Update event of the combo box as well.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    lrmcmor is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    3
    It does not refresh the form or the field I am targeting for the enable. I still have to press RefreshAll

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Are you sure that you have the code in the On Current event of the form and in the After Update event of the combo box?
    Have you checked that the code does actually run?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    lrmcmor is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    3
    on my Form.Property_Items for the field Item_From I have Event Procedure on After Update as the following:
    Private Sub Item_From_AfterUpdate()
    Me.Refresh
    End Sub

    On the form itself I have Event Procedure on On Current as:



    Private Sub Form_Current()
    If Me.Item_From = "Litigation" Then
    Me.LitigationType.Enabled = True
    Else
    Me.LitigationType.Enabled = False
    End If

    End Sub

    You may notice that my thread has slightly different fields names - I similified the verbiage in my thread.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Use:
    Private Sub Item_From_AfterUpdate()
    If Me.Item_From = "Litigation" Then
    Me.LitigationType.Enabled = True
    Else
    Me.LitigationType.Enabled = False
    End If

    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Enabling fields in form
    By Kivan in forum Programming
    Replies: 8
    Last Post: 08-22-2012, 03:44 AM
  2. Update (Refresh) Calculated Field
    By libraccess in forum Forms
    Replies: 2
    Last Post: 06-08-2012, 05:27 PM
  3. Replies: 1
    Last Post: 11-21-2011, 07:58 AM
  4. Replies: 5
    Last Post: 05-02-2011, 11:02 AM
  5. Replies: 2
    Last Post: 01-15-2011, 10:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums