Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    413

    Unanswered: True False If Criteria

    I have a bound control ( Disqualified) set to True/False and the default is false via the table. I have this control on my form form and I also have 2 lines on the form, Line73 and Line74, by that I mean they are created using the line tool and I want them visible (They are set to not being visible) if the control Disqualified is checked,else not. Here is my code which of course is NOT working.
    If [Disqualified] = True Then Line73.Visible = True
    If [Disqualified] = True Then Line74.Visible = True
    If [Disqualified] = False Then Line73.Visible = False
    If [Disqualified] = False Then Line74.Visible = False

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    put it into a sub
    then call the sub fron the various events
    in the on current event fired when the current record changes
    in the on change event of the control disqualified

    Code:
    private sub handleDisqControl
    if Disqualified = True Then
      Line73.Visible = True
      Line74.Visible = True
    else
      Line73.Visible = False
      Line74.Visible = False
    endif
    end sub
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    in the on change event of the control disqualified
    Healdem, I think you mean the on update event of the control disqualified.

    However, I have a question for Burrina. If you're using the form to scroll through the records in the table, why are you setting a default value for the form's control? It will get the value the table field gives it. If you need a default value, then
    1) you should be setting it in the table, not the form, and
    2) the default value for True/False fields/controls is ALWAYS False, so you really don't need to set it at all.

    Sam

  4. #4
    Join Date
    Nov 2011
    Posts
    413
    Since I set the option of the control as either true or false on the form,not via the table,because I then want to change the labels to either visible or not which cant be done via the table. I am suing the control from the table on the form to make my labels either visible or not which I cant do just using the table. Thanks,,,,

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Sam Landy View Post
    Healdem, I think you mean the on update event of the control disqualified.
    nope on change of the control is what I meant... as soon as the value is toggled then the visibility of the lines should be also toggled
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    BTW make life easier for yourself
    don't accept the default names for controls in forms or reports
    give every control a unique and meaningful name
    line 73 & line 74 are meaningless, you cannot derive what they are from those names.

    it pays off in the long term when some poor sap has to open the db and work out just what the feck is going on... that poor sap may be you it may be someone else. having to keep referring back to the form/report design to work out what carious controls are, what they do and why they should be visible is at best a pain in the ass at worst frustrating.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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