• Warning Message (2003)

    Author
    Topic
    #429968

    Hi,

    I want access to pops up a message if users data are not mach with database base on criteria. If no data mach with database, query won’t show anything. That’s how I wrote the code. But I don’t know after I run the code it shows ” Run-time error ‘2450’: Micorosoft Access can’t find the form ‘frmResult’ referred to in a macro expression or Visual Basic code. Below is my code:

    Private Sub Search_Click()

    If Forms![frmResult].Form.RecordsetClone.RecordCount = 0 Then
    MsgBox “There is no data for this searching. Canceling …”

    Else
    DoCmd.OpenForm “frmResult”

    End If

    End Sub

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #1002678

      That error message says that you do not have a form named frmResult. Check the spelling very carefully.

      • #1002718

        I did check the spelling, everything is correct. On the below code, the second line is highlight with yellow:

        Private Sub Search_Click()

        If Forms![frmResult].Form.RecordsetClone.RecordCount = 0 Then
        MsgBox “There is no data for this searching. Canceling …”

        Else
        DoCmd.OpenForm “frmResult”

        End If

        End Sub

        Regards

        • #1002729

          Presumably frmResult is not yet open as you try to open it in the else part of your code. The form must be open to inspect the recordsetclone.

    Viewing 0 reply threads
    Reply To: Warning Message (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: