Results 1 to 5 of 5

Thread: Why it works sometimes??

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Could someone tell me why this works only sometimes?
    It finds results only every now and then when i know there in there. Why?

    code:

    Public Sub SCHADDEE()
    ' same as date but for addressee
    On Error Resume Next
    Dim res4 As String
    Dim res5 As String
    Dim res6 As String
    Dim strInput As String

    Set rs = db.OpenRecordset("SELECT * FROM mail")
    namequery = InputBox("Enter A Name To Search For", "Name Query")
    strInput = namequery
    If StrPtr(strInput) = 0 Then
    MsgBox "Canceled By User Request", vbInformation, "Name Query"

    Else

    rs.MoveFirst
    Do Until rs.EOF

    If rs.Fields("Addressee") Like "*" & LCase(namequery) & "*" Then
    res4 = rs.Fields("Addressee")
    res5 = rs.Fields("Date")
    res6 = rs.Fields("Description")

    MsgBox res4, vbInformation, "Addressee"
    MsgBox res5, vbInformation, "Date"
    MsgBox res6, vbInformation, "Description"



    rs.MoveNext

    Else
    rs.MoveNext
    End If


    Loop
    End If
    End Sub

  2. #2
    Dreamlax
    Guest
    Take the "On Error Resume Next" part out, and see if there are acutally any errors, and if there are, fix them.

  3. #3

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    No errors appear!

    AAAAAAAHHHHHHHHHHHHH!!!

  4. #4
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Try putting single quotes around the LIKE string:

    Code:
    If rs.Fields("Addressee") LIKE "'*" & LCase(Whatever) & "*'" Then
    '
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  5. #5

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Nope.
    Still not working

Posting Permissions

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



Click Here to Expand Forum to Full Width