Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Detect blank record in subform (Acc2002 W98 Sr2)

    I have a control box on a form (with subform) that calls a report. However, if the subform has no records I want to pop up a message to inform the operator and then abort the report. My only problem is how to structure the IF statement to detect the fact that the subform has no records? Any help is very welcome.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detect blank record in subform (Acc2002 W98 Sr2)

    Hi Chuck

    Use :
    <pre>If Me.ControlSubformName.Form.Recordset.RecordCount = 0 Then
    MsgBox "There is no data"
    Exit Sub
    Else
    DoCmd.OperReport ReportName
    End If</pre>

    Francois

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Detect blank record in subform (Acc2002 W98 Sr2)

    Thanks Francois, that did the trick!

Posting Permissions

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