Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Unanswered: Minimizing Empty lines on a form/report

    Hello.

    I am looking for a bit of guidance.. I am trying to learn VBA code with Access and despite having a nice big book there is something I am struggling with.

    The overall goal is to hide a whole line of a report that isn't being filled via VBA code. I have two text boxes and one label per line and by using the "canshrink" on the text boxes, they disapear when not filled. The VBA code is supposed to make the label disappear also however this isn't happening.

    Code:
    Code:
    Private Sub Form_Load()
    If Me.txt36.Value = "<1" Then
    Me.Label33.Visible = False
    End If
    
    End Sub
    I was just wondering if anyone can point out what's wrong with that code above? It's the first piece I've tried writing and I'm finding it hard to find anywhere that lists specific rules when writing VBA.

    Really this only needs to happen when it's in print preview.

    I thought this would work but it doesn't so does anyone have any advice or guidance?

    Many thanks.
    Adam.

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    Try this.
    If ([txt36]).Value = <1 Then
    Me.txt36.Visible = False
    End If

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    visible means the rows wopnt appear, but they are still there

    as Burrina points out try <1 in place of "<1"
    <1 means is the value is less than 1, "<1" means do a string comparison and set visibility to false if the vale matches "<1"
    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
  •