Blue Ridge Software LLC
  Encryption
Services
  Webmaster
Services
  Programming   Software   About Us

Program Snippets

  Access 97 - Check Form for Records (Add To Favorites)
Function FormHasRecords(f As Form) As Boolean
'---------------------------------------------------------------------------------'
' Returns False if the form contains no records and True if it contains records.
'
' Calling Convention (from a control):
'    =FormHasRecords(Form)
'    =FormHasRecords(MySubform.Form)
'    =FormHasRecords(MySubform.Form!MySubSubform.Form)
'
' Calling Convention (Event Code):
'    If FormHasRecords(Me) Then
'    If FormHasRecords(Forms!AnotherForm) Then
'---------------------------------------------------------------------------------'
    Dim rs As Recordset
    On Error Resume Next
    Set rs = f.RecordsetClone
    rs.MoveFirst
    FormHasRecords = Not err.Number And Not rs.EOF
    rs.Close
    
End Function
© 2013- Blue Ridge Software LLC