Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Toggle Status specific to a record (2000)

    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
    Best Regards,

    Luke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Toggle Status specific to a record (2000)

    No need to apologize for asking many questions - that is what the Lounge is for! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    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.

  3. #3
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Toggle Status specific to a record (2000)

    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
    Best Regards,

    Luke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Toggle Status specific to a record (2000)

    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.

  5. #5
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Toggle Status specific to a record (2000)

    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.
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

Posting Permissions

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