Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2007
    Posts
    10

    Unanswered: Disable control for a specific record

    Hi all,

    Any help appreciated.

    I have a form which lists several records at a time, in a tabular format. On this form, there's a checkbox called postponed.

    When this box is clicked, I want to disable certain checkboxes, but for that record only. Currently, my code disables the checkbox for all records.

    My code is:

    Code:
    Private Sub Postponed_AfterUpdate()
        '-1 in the Postponed checkbox means the flag is set
        '0 means it's unset
        If Me!postponed = -1 Then
            ' if the match is postponed, prevent the changing of the umpires
            Me!Umpire1Choice.Enabled = False
        Else
            ' if the match is un-postponed, enable the changing of the umpires
            Me!Umpire1Choice.Enabled = True
        End If
    End Sub
    I've checked the Help and used Google, but to no avail. Any & all suggestions welcome.

    Thanks in advance

    Jim

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You'll need to put in some code in the Form_Current event procedure that does exactly what your code is doing.... preferably you should call a common subprocedure from both so you don't have duplicated code
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jul 2007
    Posts
    10
    Thanks for your suggestion.

    Unfortunately it doesn't solve my issue - what happens is that on clicking the checkbox the control is still disabled on every record. Moving to another record does enable the control, but on every record, including the one where the checkbox is ticked!

    Am I approaching this the right way, or is there another tack I could take?

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Ah... this is on a continuous form.

    So it should be at a point that (despite the visual issue of showing disabled/enabled controls on all records) if the user selects the record first, the controls are set correctly for that record -- the current record.

    Is it a subform?

    I need sleep
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jul 2007
    Posts
    10
    Thanks for your help - it is a continuous form, and no there are no subforms involved.

    I've gone another way for now, it's inelegant and I'm not happy but it's getting the job done. If you'd more advice I'd appreciate hearing it.

    Thanks

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Which way did you go?

    The only options I can come up with atm is to put the controls in the form's header or footer or to make an unbound form with multiple control sets. Coding the latter is pretty intense though
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Jul 2007
    Posts
    10
    Now I'm changing the value of the field in the underlying table to be one that delivers a "Match Postponed" narrative in the control. It's not pretty, and there's still some bugs to sort out (having to requery, then moving the display to the correct record) but it'll do the job.

    As for coding an unbound report, I'm doing that at the moment for another section of the database. I have it working nicely placing labels with the correct data, but I cannot for the life of me figure out a way of selecting & deleting the labels currently on the report before writing new ones. Any suggestions?

Posting Permissions

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