Results 1 to 4 of 4

Thread: No Value error

  1. #1
    Join Date
    May 2002
    Posts
    16

    Unanswered: No Value error

    I am receiving: Run-time error '2427' You have entered an expression that has no value.

    I have a macro set up so that someone can enter text into a textbox on a form and click a search button. The macro then opens another form with the resulting recordset from a hidden query.

    The problem is, if there are no matches (query returns nothing), then the second form appears blank, nothing.

    I thought if I checked the value of the result field for Null, at the OnOpen event of the second form, then that would tell me if the query returned nothing. However, IsNull returns False. But if i try to debug.print the field, I get the above error.

    How does this field have no value yet is not null?

    Any ideas anyone?

    THanks

    Greg

  2. #2
    Join Date
    May 2002
    Posts
    16
    Need a way to check if the query returns nothing. Any ideas?

  3. #3
    Join Date
    Nov 2001
    Posts
    336
    In your second form's Open event put the code:

    ' Access 2000 version
    If Me.Recordset.RecordCount = 0 Then
    MsgBox "No Data."
    cancel=True
    End If

    Igor

  4. #4
    Join Date
    May 2002
    Posts
    16
    Thanks man. Worked great. I am new to Access and VBA so sometimes I have silly questions. Thanks again.

    gmo

Posting Permissions

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