Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2009
    Posts
    39

    Unanswered: Text Box/Combo Box Visibility (again)

    Ran into another roadblock. Tab 1 has the combo box VEH_TYPE and text box PILOT. Tab 2 has the text box BODY_MANF_NMBR. I need the BODY# to be visible for multiple choices. Here is what I have:

    Private Sub VEH_TYPE_AfterUpdate()
    Me.PILOT.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine")
    Me.BODY_MANUF_NMBR.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine")
    Me.BODY_MANUF_NMBR.Visible = (Left(Me.VEH_TYPE, 3) = "c.c.v.")
    End Sub

    I swear it worked at first, and then I went to distribute it and of course it decided to only partially work (secretly, I think the program has it out for me...). PILOT is working correctly. BODY_MANF_NMBR is visible when "c.c.v." is chosen, but not when "fire engine" is chosen. As I am still new to this code writing thing, am I missing a phrase/command somewhere?

    Thanks in advance :-)

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Well, logically if it's fire engine then it's not c.c.v. In other words, the second line will cancel out the first. Perhaps

    Me.BODY_MANUF_NMBR.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine") OR (Left(Me.VEH_TYPE, 3) = "c.c.v.")
    Paul

  3. #3
    Join Date
    Dec 2009
    Posts
    39
    Thanks! I had tried the OR before, but was putting the whole string instead of just the additional "Left". Good to know!

  4. #4
    Join Date
    May 2010
    Posts
    601
    The length of "c.c.v." is 6 not 3.

    So you will need to use:

    Left(Me.VEH_TYPE, 6) = "c.c.v."
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  5. #5
    Join Date
    Dec 2009
    Posts
    39
    The "." was for the benefit of the post. If I type c.c.v. without the "." it come out like this ***

  6. #6
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by SRR View Post
    The "." was for the benefit of the post. If I type c.c.v. without the "." it come out like this ***
    I have had issues like that while posting here. The forum software must be filtering "bad" words and does not like it.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  7. #7
    Join Date
    Dec 2009
    Posts
    39
    OK, I swear I am never going to be done with this issue, but I have another hurdle. The visibility features now work great, but the field does not remain visible. If I am in the record, the boxes appear and disappear correctly. I have a record where they are suppose to be visible. I enter my information, exit the program, re-enter, pull up the record, and the boxes are invisible again! The entered data is still there, no worries, but how do I get the visibility to stay?

  8. #8
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by SRR View Post
    OK, I swear I am never going to be done with this issue, but I have another hurdle. The visibility features now work great, but the field does not remain visible. If I am in the record, the boxes appear and disappear correctly. I have a record where they are suppose to be visible. I enter my information, exit the program, re-enter, pull up the record, and the boxes are invisible again! The entered data is still there, no worries, but how do I get the visibility to stay?
    You will need to run the code in the after update event of controls for the current record as you enter data. When viewing existing records you will need to also run the same code in the form's on current event.

    I usually put code used like this in a sub routine in the form so that it can be call from multiple events.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  9. #9
    Join Date
    Dec 2009
    Posts
    39
    ARGH! Why is it always the simple solutions that elude me? The On Current solved the issue. Thanks, you're a star!

  10. #10
    Join Date
    May 2010
    Posts
    601

    Thumbs up

    Quote Originally Posted by SRR View Post
    ARGH! Why is it always the simple solutions that elude me? The On Current solved the issue. Thanks, you're a star!
    You're welcome!

    I do believe programming is really not logical to humans. You have to be shown and memorize how to do it. I came to this realization after 30+ years of training programmers and also users on how to use software.

    You have learned a lot. Great job!
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

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