No Records Found

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amywolfie

    No Records Found

    I am trying to code a custom dialog when "No Records Are Found" on a Find button.

    This is the code I have so far -- I'm getting an error 91:

    Function NoRecordsFound( )

    On Error GoTo Error_Handler:

    Dim rstFees As Recordset

    rstFees.MoveLas t

    If rstFees.RecordC ount = 0 Then
    MsgBox "Sorry no records found."

    End If

    rstFees.Close

    Exit Function

    Error_Handler:
    MsgBox Err.Description & Err.Number

    End Function
    ==
    Thanks!

    amy
    =
  • Deano

    #2
    Re: No Records Found

    amywolfie wrote:[color=blue]
    > I am trying to code a custom dialog when "No Records Are Found" on a
    > Find button.
    >
    > This is the code I have so far -- I'm getting an error 91:
    >
    > Function NoRecordsFound( )
    >
    > On Error GoTo Error_Handler:
    >
    > Dim rstFees As Recordset
    >
    > rstFees.MoveLas t
    >
    > If rstFees.RecordC ount = 0 Then
    > MsgBox "Sorry no records found."
    >
    > End If
    >
    > rstFees.Close
    >
    > Exit Function
    >
    > Error_Handler:
    > MsgBox Err.Description & Err.Number
    >
    > End Function
    > ==
    > Thanks!
    >
    > amy
    > =[/color]

    You haven't Set rstFees to anything.

    e.g Set rstFees = Me.recordsetclo ne

    Also I think rstFees.MoveLas t might throw up an error if there are no
    records but you should set the recordset variable first and then try again..


    Comment

    Working...