Results 1 to 2 of 2

Thread: Message Box if there are No Records in a Form

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Location
    Toronto, Canada
    Posts
    41

    Message Box if there are No Records in a Form

    Hi
    I am trying to get a Message Box if there are No Records in a Form, here is the code.
    thank you in advance
    Pretty

    VB Code:
    1. Private Sub Command40_Click()
    2. On Error GoTo Err_Command40_Click
    3. Dim stDocName As String
    4. Dim stLinkCriteria As String
    5. Dim intHolder As Integer
    6. intHolder = DCount("UnitAreaName", "qryMainDue")
    7. If intHolder > 0 Then
    8. stDocName = "frmDue"
    9. DoCmd.OpenForm stDocName, , , stLinkCriteria
    10. Else
    11. MsgBox "There are no records, therefore the request has been cancelled"
    12. End If
    13. Exit_Command40_Click:
    14. Exit Sub
    15. Err_Command40_Click:
    16. MsgBox Err.Description
    17. Resume Exit_Command40_Click
    18. End Sub

  2. #2
    Hyperactive Member binilmb's Avatar
    Join Date
    Nov 2005
    Location
    Kochi
    Posts
    472

    Re: Message Box if there are No Records in a Form

    if you want to display the message box by checking the number of records then you wnat to check the recordset by using "recordcount" property.
    ßįňįl

Posting Permissions

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



Click Here to Expand Forum to Full Width