Results 1 to 6 of 6
  1. #1
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100

    Conditionally formatting a line on a continuous form


    I have a subform in which is a continous form. The subform only has two controls, a text value and a numeric value. The numeric value is in a text box called "txtRoll". I want the line on the bottom of the subform's row (named "LineEvery5") to show conditionally if txtRoll = 30, 35, 40 or 45. As a line will not respond to conditional formatting (the option on the menu is "grayed out"), I tried the following code on the OnCurrent event of the subform. (I simplified the constraints as I was having trouble with the OR syntax)
    Code:
     
        If Me.txtRoll = 30 Then
            Me.LineEvery5.Visible = True
                Else:
                Me.LineEvery5.Visible = False
        End If
    I also tried this.
    Code:
     
        If Me.txtRoll.Value = 30 Then
            Me.LineEvery5.Visible = True
                Else:
                Me.LineEvery5.Visible = False
        End If
    Interestingly, in both cases, LineEvery5 disappears. If I comment out the code, LineEvery5 is visible on every row. Clearly I am not getting a "True" from my If clause. What code might give me a True when txtRoll equals 30, 35, 40, or 45?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can do that type of formatting on a report, not a form. The report has a detail format event that fires for every record. Forms don't have that. The current event will only fire for the "current" record, and will apply the formatting to every record. That's why the line is blank for every row. If you selected the record with 30, every row would display the line.

    The only solution that comes to mind is using a textbox with a control source of just spaces, with underlining on. Use conditional formatting on that (setting the font).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Quote Originally Posted by pbaldy View Post
    You can do that type of formatting on a report, not a form.
    OUCH! That makes getting to where I want to be difficult.

    While I work on your text box-with-underlined-spaces solution, I thought I'd post a capture of my form to illustrate the issue. Each column of text and number combinations is a subform. I've turned off the lines on the first subform.

    My goal is to carry each horizontal line on the main form (below 30, 35, 40, 45 and 50) fully across the form while leaving out the other horizontal lines. I've tried, without success, to "trick" access into letting me set the BackColor/BackStyle of the detail of the subform to transparent so the lines passing behind the subform show. I've also tried, equally unsuccessfully, to bring the main form lines in front of the subform.

    I am sure those of you more versed in the code stand a better chance of making one of these two routes work as well as some other, more creative solution.

  4. #4
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Quote Originally Posted by pbaldy View Post
    The only solution that comes to mind is using a textbox with a control source of just spaces, with underlining on. Use conditional formatting on that (setting the font).
    The Force is strong with this one!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It's working for you? It feels like a kludge, but I can't think of a better way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Quote Originally Posted by pbaldy View Post
    It's working for you? It feels like a kludge, but I can't think of a better way.
    A Kludge? Maybe. But to paraphrase Rural Guy on one of my other solutions, there's a lot to be said for "It works."

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-20-2011, 01:50 PM
  2. Replies: 7
    Last Post: 04-11-2011, 03:58 PM
  3. How to do line by line compare of VB code?
    By Buakaw in forum Access
    Replies: 2
    Last Post: 02-14-2011, 11:46 PM
  4. Replies: 1
    Last Post: 07-22-2010, 05:55 AM
  5. Continuous Form
    By duckie10 in forum Access
    Replies: 13
    Last Post: 06-09-2009, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums