check box to toggle controls enabled not working on saved records

Discussion in 'Microsoft Access Form Coding' started by Darryn, Oct 24, 2003.

  1. Darryn

    Darryn Guest

    Hi all

    I have a number of check boxes on a form which are used the toggle the
    enabled status of other controls (I want to disable input into certain
    fields if it is not required by the user). I have this working fine
    using the following two event proceedures, so when a new record is
    being entered the user checks the boxes and the fields are enabled.

    Private Sub IsUnique_AfterUpdate()
    If Me.IsUnique = True Then
    Me.Quantity.Enabled = False
    Me.SerialNumber.Enabled = True
    Else
    Me.Quantity.Enabled = True
    Me.SerialNumber.Enabled = False
    End If
    and
    Private Sub YearColourCoded_AfterUpdate()
    Me.cboYearColourCode.Enabled = Me.YearColourCoded
    End Sub

    When I am navigating back through saved records the checkboxes are
    still checked but the other controls are being disabled. Is there any
    way to refresh or requery the check boxes when a record is reloaded.

    I have tried to add the following
    Me.Requiresmaintenance.Requery
    Into the on current and on load event in the forms property
    but it has had no effect and I am at a loss to work out how to do it

    Thanks

    Darryn
     
    Darryn, Oct 24, 2003
    #1
    1. Advertisements

  2. Darryn

    Gary Miller Guest

    Darryn,

    I would suggest moving your code as-is to the OnCurrent
    Event of the Form. This will get triggered every time you
    move from record to record and should do what you are
    looking for.

    Gary Miller

    "Darryn" <> wrote in message
    news:...
    > Hi all
    >
    > I have a number of check boxes on a form which are used

    the toggle the
    > enabled status of other controls (I want to disable input

    into certain
    > fields if it is not required by the user). I have this

    working fine
    > using the following two event proceedures, so when a new

    record is
    > being entered the user checks the boxes and the fields are

    enabled.
    >
    > Private Sub IsUnique_AfterUpdate()
    > If Me.IsUnique = True Then
    > Me.Quantity.Enabled = False
    > Me.SerialNumber.Enabled = True
    > Else
    > Me.Quantity.Enabled = True
    > Me.SerialNumber.Enabled = False
    > End If
    > and
    > Private Sub YearColourCoded_AfterUpdate()
    > Me.cboYearColourCode.Enabled = Me.YearColourCoded
    > End Sub
    >
    > When I am navigating back through saved records the

    checkboxes are
    > still checked but the other controls are being disabled.

    Is there any
    > way to refresh or requery the check boxes when a record is

    reloaded.
    >
    > I have tried to add the following
    > Me.Requiresmaintenance.Requery
    > Into the on current and on load event in the forms

    property
    > but it has had no effect and I am at a loss to work out

    how to do it
    >
    > Thanks
    >
    > Darryn
     
    Gary Miller, Oct 24, 2003
    #2
    1. Advertisements

  3. Darryn

    Darryn Guest

    On Thu, 23 Oct 2003 22:40:09 -0700, "Gary Miller"
    <> wrote:

    >Darryn,
    >
    >I would suggest moving your code as-is to the OnCurrent
    >Event of the Form. This will get triggered every time you
    >move from record to record and should do what you are
    >looking for.


    Sorry to to sound thick but which bit of code?

    I have already tried
    Private Sub Form_Current()
    Me.IsUnique.Requery
    Me.RequiresMaintenance.Requery
    End sub

    But this did nothing

    I also just tried to C/P
    >> If Me.IsUnique = True Then
    >> Me.Quantity.Enabled = False
    >> Me.SerialNumber.Enabled = True
    >> Else
    >> Me.Quantity.Enabled = True
    >> Me.SerialNumber.Enabled = False

    from the IsUnique afer update event but this did nothing either

    Darryn
     
    Darryn, Oct 24, 2003
    #3
  4. Darryn

    Gary Miller Guest

    Private Sub Form_Current()
    If Me.IsUnique = True Then
    Me.Quantity.Enabled = False
    Me.SerialNumber.Enabled = True
    Else
    Me.Quantity.Enabled = True
    Me.SerialNumber.Enabled = False
    End If
    End Sub

    This will have the form check the values for an existing
    record as you move to it and set the controls enabled or not
    based on what is already there.

    Gary Miller


    > Sorry to to sound thick but which bit of code?
    >
    > I have already tried
    > Private Sub Form_Current()
    > Me.IsUnique.Requery
    > Me.RequiresMaintenance.Requery
    > End sub
    >
    > But this did nothing
    >
    > I also just tried to C/P
    > >> If Me.IsUnique = True Then
    > >> Me.Quantity.Enabled = False
    > >> Me.SerialNumber.Enabled = True
    > >> Else
    > >> Me.Quantity.Enabled = True
    > >> Me.SerialNumber.Enabled = False

    > from the IsUnique afer update event but this did nothing

    either
    >
    > Darryn
     
    Gary Miller, Oct 24, 2003
    #4
  5. Darryn

    Darryn Guest

    On Fri, 24 Oct 2003 08:19:09 -0700, "Gary Miller"
    <> wrote:

    >
    >Private Sub Form_Current()
    >If Me.IsUnique = True Then
    > Me.Quantity.Enabled = False
    > Me.SerialNumber.Enabled = True
    > Else
    > Me.Quantity.Enabled = True
    > Me.SerialNumber.Enabled = False
    > End If
    >End Sub
    >
    >This will have the form check the values for an existing
    >record as you move to it and set the controls enabled or not
    >based on what is already there.


    I was soo close with this one!!
    >> I also just tried to C/P
    >> >> If Me.IsUnique = True Then
    >> >> Me.Quantity.Enabled = False
    >> >> Me.SerialNumber.Enabled = True
    >> >> Else
    >> >> Me.Quantity.Enabled = True
    >> >> Me.SerialNumber.Enabled = False


    But I had left out this bit!!!
    > End If

    Thanks so much

    Darryn
     
    Darryn, Oct 25, 2003
    #5
    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. Matt Williamson

    Toggle group of controls visibility with option buttons

    Matt Williamson, Oct 2, 2003, in forum: Microsoft Access Form Coding
    Replies:
    3
    Views:
    266
    Kelvin
    Oct 3, 2003
  2. Bill

    Frustrated with Toggle and Check Box

    Bill, Jun 11, 2004, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    151
    Graham R Seach
    Jun 11, 2004
  3. Bill

    Re: Frustrated with Toggle and Check Box

    Bill, Jun 11, 2004, in forum: Microsoft Access Form Coding
    Replies:
    2
    Views:
    183
    Mingqing Cheng [MSFT]
    Jun 14, 2004
  4. Guest

    Toggling data fields enabled / not enabled

    Guest, Feb 18, 2005, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    343
    Guest
    Feb 19, 2005
  5. JamiOrtung

    msg box - remove check box or keep check box in form

    JamiOrtung, Sep 22, 2009, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    494
    Mark Andrews
    Sep 22, 2009
Loading...

Share This Page