Results 1 to 9 of 9
  1. #1
    sconard is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    10

    check textbox1 on each record of report

    I cannot seem to find the combination of event and method to check the value of a textbox for each record in an Access report.
    For example using TextboxA, TextboxB:(both on main report)
    if TextboxA does not have a value, than show textboxB
    I have tried going to the report in design mode, clicking on the detail header, selecting the "on format" event and going to the code editor and entering



    If Nz(textBoxName, "") & "" <> "" Then
    textBox2Name.Visible = True
    Else
    textBox2Name.Visible = False
    End If

    but if I place a breakpoint at the conditional, the code is never reached

  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
    Make sure you open the report in Preview mode. The format events do not fire in Report view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sconard is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    10
    So where do I put this code if I want it to also appear in report view?
    If I place similar code in the expression for the data for the control, the results only show for the first page. I am not certain if that is because the report has a subreport or not.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not sure you can use code for report view. I'd probably use Conditional Formatting; you can't set visible, but you can change the font color to match the back color, effectively making the textbox invisible. Or you can use an expression:

    =IIf(Nz(textBoxName, "") & "" <> "", FieldName, "")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    sconard is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    10
    As mentioned: The use of this expression only functions for the first two records or is limited to seemingly the first page

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Just tested this in the detail section of a report in report view:

    =IIf(Nz([MechanicName],"")<>"",[ServiceDate],"")

    and it worked exactly as expected.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    sconard is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    10
    And the expression works exactly as expected for me as well on the first page of the report. Unfortunately the subsequent pages do not function. I think it has something to do with there being a sub report present but I cannot find the answer.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db, or a representative sample?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    sconard is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    10

    Appearances can be deceiving

    After nearly giving up on this I demonstrated the issue on another machine. On that machine the same database actually shows all records as expected. What is odd is that the field that is generated by the expression does not show up on subsequent records on the dev box but appear on a client machine with the same version of Access (2007). Further: The expression field flickers when the report is scrolled on the client machine. It sometimes disappears and within as much as 7 seconds, reappears.

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

Similar Threads

  1. check box on report odd phenomenon
    By wb3 in forum Reports
    Replies: 2
    Last Post: 09-08-2010, 06:18 PM
  2. Replies: 0
    Last Post: 07-05-2010, 08:00 AM
  3. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  4. Replies: 1
    Last Post: 02-02-2009, 05:52 AM
  5. Apply check at record level
    By wasim_sono in forum Programming
    Replies: 1
    Last Post: 04-19-2007, 07:48 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