• Toggle Status specific to a record (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Toggle Status specific to a record (2000)

    Author
    Topic
    #416955

    Firstly I have to say this is an excellent resource, and sorry for some many questions in a short space of time.

    I have a toggle field on a form. How can I get this button to be specific to each record. I.e the default is de-pressed if I press it it does not effect the other records in the form? this is probably a very obvious issue.

    Thanks in advance.

    Luke

    Viewing 0 reply threads
    Author
    Replies
    • #934041

      No need to apologize for asking many questions – that is what the Lounge is for! smile

      I assume you’re talking about a continuous form. The only way to make the state of a toggle button specific to each record is to bind it to a Yes/No field in that record. Unbound controls (i.e. with a blank Control Source property) behave the same for all records in the form.

      • #934121

        Thanks for the help, justa further development.

        I have told the toggle button to have the control source of a yes/no field in the table. In the onclick event of this button I have the following code

        Private Sub optPDetails_Click()

        Me.PPTitle.Visible = optPDetails
        Me.PPInitials.Visible = optPDetails
        Me.PPFirstname.Visible = optPDetails
        Me.PPLastname.Visible = optPDetails
        Me.PPLastname.Visible = optPDetails

        End Sub

        However The data is still not specific to each record. It will show the button pressed but the fields are still hidden.

        Luke

        • #934126

          I don’t understand why the controls should remain hidden, but you have another problem here: if you hide or unhide a control in a continuous form, it will affect the control in ALL records, not just in the current record. It is important to keep in mind that there is actually only one set of controls in the detail section of a continuous form, irrespective of the number of records that is visible. Only things directly related to the underlying data vary from record to record, such as the text in a text box, the status of a check box or toggle button, or conditional formatting. The latter (conditional formatting) may be the way to go for you – you can set the text color and the background color of a control using conditional formatting, as well as its enabled/disabled status.

        • #934127

          Ah, I see what you’re after – and unfortunately I don’t think it can be done. A control is either visible or not at any time, so if you’re trying to hide a control in some records and not others, in Continuous Forms view, you’re stuffed I’m afraid.

          What you can do though is copy that code from Private Sub optPDetails_Click() to Private Sub Form_Current() so that as the user moves from one record to another, the controls will appear or disappear according to the optPDetails box for the record they’ve moved to.

    Viewing 0 reply threads
    Reply To: Toggle Status specific to a record (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: