Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Moving text up when the above field is Null (Access XP)

    In a block of textboxes, such as an address sometimes the textbox for Street2 is null. Question 1: How can I move the lines below that textbox up one position when it is null?

    Question 2: How can you make a textbox invisible if there is no data in the textbox. I have two fields called WC# and WC#Fee. If there is no fee in the WC#Fee I want both fields to become invisible. How can I make that happen?

    Thank you.

    Fay

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Moving text up when the above field is Null (Access XP)

    Fay,

    Q2) Assuming this is for a form, you will need to use the OnCurrent event of the form to determine the value of the WC# field. Something like:

    If IsNull([WC#]) And Me.NewRecord <> True Then
    Me.WC_.Visible = False
    Me.WC__Label.Visible = False
    Me.WC_Fee.Visible = False
    Me.WC_Fee_Label.Visible = False
    Else
    Me.WC_.Visible = True
    Me.WC__Label.Visible = True
    Me.WC_Fee.Visible = True
    Me.WC_Fee_Label.Visible = True
    End If

    The check for the New record is there to make sure that the textboxes, etc. are visible if you are entering a new record.

    Now back to Q1, is this on a form or report?
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Moving text up when the above field is Null (Access XP)

    Bryan thank you for your response. Both questions relate to a report not a form.

    Fay

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

    Re: Moving text up when the above field is Null (Access XP)

    In a report, you can set the CanShrink property to True for all controls whose vertical space should be removed when they are empty, and also for the section they are in.

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Moving text up when the above field is Null (Access XP)

    Thanks Hans. That worked for the Address block.
    That did not work for the WC fields that had no number in them other than the default $ 0.00. In that area of the form if there is no WC# I want that control not to be display AND the WCFee control to not be displayed.

    Thanks Fay

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

    Re: Moving text up when the above field is Null (Access XP)

    You can use Bryan Carbonell's code to make the WC fields invisible if there is no WC#. If the CanShrink property of the section is set to True, this should also cause the controls below them to move up.

Posting Permissions

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