Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Posts
    223

    Red face Unanswered: For Each ctrl In Me

    I have a Query which starts a report.

    In my Report I used to have a hidden Text Box which woudl (hopefully) be unhidden if the Query produced No records. I actually never got to test it properly!!

    But now when I get No Records, the Report does not open, and i get an error message saying:-

    Cannot find the object 'For Each ctrl In Me'.

    Maybe this is residue from my previous attempts? Or is this a standard message?
    What would you attempt to do if you knew you would not fail?

  2. #2
    Join Date
    Nov 2009
    Posts
    223
    Whehey.
    I managed to find the residue from a previous attempt to print a Report with no records.

    It was inthe OnNoData section of the Report.

    I have deleted the following code and it now prints/shows the Report even if it has no data.

    Not sure if this code will be helpful to thers who are trying to achieve the same thing?

    For Each ctrl In Me.Controls
    If ctrl.Name = "LabelNrcords" Then
    ctrl.Caption = Me.Caption & "has no daya"
    ctrl.Visible=True
    Else
    ctrl.Visible=False
    End If
    Next ctrl
    What would you attempt to do if you knew you would not fail?

Posting Permissions

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