Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Boise, Idaho, USA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No data - message on form (2000)

    I know about the on nodata for reports but how do I know when there is no data for a form? If my query behind the form is null then I get a totally blank area on the form where the detail is. I want to tell my users that they currently have no data to display.

    I figure it's pretty easy but I don't know where to look for the solution.

    Your help would be appreciated

  2. #2
    Lounger
    Join Date
    May 2002
    Location
    Fort Worth, Texas, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: No data - message on form (2000)

    Try something like this on frmOne.

    <pre>Private Sub cmdOpenFormTwo_Click()

    DoCmd.OpenForm "frmTwo"

    If Forms!frmTwo.CurrentRecord = 0 Then
    MsgBox "There are no records.", vbOKOnly
    DoCmd.Close acForm, "frmTwo"
    Else
    DoCmd.Close acForm, "frmOne"
    End If

    End Sub
    </pre>


  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: No data - message on form (2000)

    You can handle it in the Open event of the form. Do something like this:

    Private Sub Form_Open(Cancel As Integer)
    If Me.RecordsetClone.EOF Then
    Cancel = True
    MsgBox "There are no records for the form."
    End If
    End Sub
    Charlotte

Posting Permissions

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