Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hiding Control On Form (2000)

    Hi,
    I have a form with a subform. On the subform I want the cboVendorList combo box to be hidden unless the cboRecSource (combo box based off the lngRecSourceID) equals "Vendor" or number 4 (record ID in table). I'd like it to be hidden when the forms first opens, a new record is started or another choice is selected. Also I'd like it to continually show if its = vendor.

    Right now i have it half working. I have the following event proc applied to the cboRecSource afterupdate.
    Private Sub cboRecSource_AfterUpdate()
    'Make the vendor combo box visible when select vendor
    If Me.lngRecSourceID.Value = 4 Then
    Me.cboVendorList.Visible = True
    Else
    Me.cboVendorList.Visible = False
    End If
    End Sub

    It works in the sense that when i choose vendor the list shows up and if I click on something else the list goes away. The problem, the cboVendorList is showing when I go to a new record and when I open the form. Also, when I pick something else from the list, it hides cboVendorList for all previous records as well.

    Any help would be greatly appreciated. [img]/forums/images/smilies/smile.gif[/img]
    Deb

  2. #2
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding Control On Form (2000)

    I forgot to add to my post below. I am a newbie at programming so be gentle. [img]/forums/images/smilies/smile.gif[/img]

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

    Re: Hiding Control On Form (2000)

    Is your subform a continuous subform? If so, you have a problem, for you can only make the combo box visible or invisible for ALL records, not for individual records. This is because a continuous form may display multiple records, but it still contains only a single set of controls. The only things that vary from record to record are the field values and, if set, conditional formatting. You could use conditional formatting to set the font color and fill color of the combo box to the same color as the background of the section if lngRecSourceID is not equal to 4.

    In your code, you would need to repeat the code in the On Current event of the form to show/hide the combo box as the user moves from record to record. But, as noted, the effect will not be what you want in a continuous form.

  4. #4
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding Control On Form (2000)

    Thanks Hans,
    It is a continuous form. I'll give the conditional option a try.

  5. #5
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding Control On Form (2000)

    Hans,
    would it also do the same thing with the enable feature? All or none?

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

    Re: Hiding Control On Form (2000)

    If you were to set the Enabled property in code, it would be all or nothing, but if you set it in conditional formatting, it will be for individual records (Enabled is the last item, at least it is in Access 2002, see screenshot.)
    Attached Images Attached Images
    • File Type: png x.PNG (2.2 KB, 0 views)

  7. #7
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding Control On Form (2000)

    Hans,
    I never used conditional formatting in Access before. Really cool feature. It did what I wanted and was much easier than code, at least for me. [img]/forums/images/smilies/wink.gif[/img]
    As always, thanks a TON for your hlep.
    Deb

Posting Permissions

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