Problem with after update code in field that disables another field

Discussion in 'Microsoft Access Forms' started by SamJ, Feb 25, 2008.

  1. SamJ

    SamJ Guest

    Hi

    I want to be able to disable the Non Member field in a record when
    something is entered in the Member field. Unfortunately, the code I am
    usng below disables the Non Member field in *all* records, and the
    database has to be closed and reopened to get round this before data
    entry can continue.

    I'd be grateful if someone could show me the correction, Thanks.


    Private Sub Member_AfterUpdate()

    If Not IsNull([Member]) Then
    Me![Non Members].Enabled = False
    Else
    Me![Non Members].Enabled = True
    End If
    End Sub
     
    SamJ, Feb 25, 2008
    #1
    1. Advertisements

  2. SamJ

    Al Campagna Guest

    Sam,
    You need to put that same code in on the OnCurrent event of the form.
    When you programatically disable a field during a form "session" it will
    disable that field on all records.
    Using your code in the OnCurrent event of the form, allows you to examine
    the Member value of that record, and Enable/Disable accordingly.

    --
    hth
    Al Campagna
    Microsoft Access MVP
    http://home.comcast.net/~cccsolutions/index.html

    "Find a job that you love... and you'll never work a day in your life."

    "SamJ" <> wrote in message
    news:...
    > Hi
    >
    > I want to be able to disable the Non Member field in a record when
    > something is entered in the Member field. Unfortunately, the code I am
    > usng below disables the Non Member field in *all* records, and the
    > database has to be closed and reopened to get round this before data
    > entry can continue.
    >
    > I'd be grateful if someone could show me the correction, Thanks.
    >
    >
    > Private Sub Member_AfterUpdate()
    >
    > If Not IsNull([Member]) Then
    > Me![Non Members].Enabled = False
    > Else
    > Me![Non Members].Enabled = True
    > End If
    > End Sub
    >
     
    Al Campagna, Feb 25, 2008
    #2
    1. Advertisements

  3. SamJ

    SamJ Guest

    In article <>,
    says...
    > Sam,
    > You need to put that same code in on the OnCurrent event of the form.
    > When you programatically disable a field during a form "session" it will
    > disable that field on all records.
    > Using your code in the OnCurrent event of the form, allows you to examine
    > the Member value of that record, and Enable/Disable accordingly.


    Ok, thanks.
     
    SamJ, Feb 25, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vince

    After update field copy the same text to another field

    Vince, Sep 5, 2003, in forum: Microsoft Access Forms
    Replies:
    3
    Views:
    206
    Gary Miller
    Sep 5, 2003
  2. Guest

    field in a form match another field in another form

    Guest, May 20, 2005, in forum: Microsoft Access Forms
    Replies:
    3
    Views:
    213
    Jeff Boyce
    May 21, 2005
  3. Guest
    Replies:
    1
    Views:
    164
    Steve Schapel
    Jul 8, 2005
  4. Guest

    Read only mode disables combo box

    Guest, Sep 29, 2006, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    234
    strive4peace
    Sep 30, 2006
  5. Fox
    Replies:
    2
    Views:
    381
Loading...

Share This Page