Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Phoenix, AZ
    Posts
    122

    Unanswered: Why won't this work?

    I used this code for a form that I made:
    If Me.Recordset.RecordCount = 0 Then
    MsgBox "No Accounts Found."
    Cancel = True
    End If
    It works fine. I tried to use this same thing on a report and it didn't work. Can anyone help?
    I want a report to return a "No Records Found" message if that is the case. Right now, My report opens to a blank report.

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    No data event of report

    Insert this into the report no data event...

    Private Sub Report_NoData(Cancel As Integer)

    MsgBox "No data for this period...cancelling report.", vbOKOnly
    Cancel = True

    End Sub


    ...should do the trick
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Dec 2002
    Location
    Phoenix, AZ
    Posts
    122
    Thanks!!! Works great!

  4. #4
    Join Date
    Dec 2002
    Location
    Phoenix, AZ
    Posts
    122
    Is there anything that would work for a table. I have a form in my database that gives the user the option of viewing the filtered data through a form, report or a table. If there is no data that matches the criteria, how can I have a msg box open, stating that there is no data instead of a blank table?

Posting Permissions

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