Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Warning Message (2003)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Warning Message (2003)

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

  3. #3
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Warning Message (2003)

    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

  4. #4
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Warning Message (2003)

    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.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

Posting Permissions

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