Results 1 to 12 of 12

Thread: Whats wrong with this SQL query?

Threaded View

  1. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665
    This is exactly what I get with Debug.print.
    VB Code:
    1. SELECT * FROM tbltable1 WHERE tbltable1.[Field1] Is Null AND tbltable1.[Field2] ="D=8
    2. L=30
    3. U=37VAC
    4. R=160W";

    Why can´t I use BOF and EOF whith the code? Now I always get True on both EOF and BOF.
    VB Code:
    1. If Len(Me![Text0]) > 0 Then
    2. Number1 = "='" & Me![Text0] & "'"
    3. Else
    4. Number1 = "Is Null"
    5. End If
    6.  
    7. If Len(Me![Text1]) > 0 Then
    8. Number2 = "='" & Me![Text1] & "'"
    9. Else
    10. Number2 = "Is Null"
    11. End If
    12.  
    13. SQL = "SELECT * FROM tbltable1 "
    14.  
    15. SQLWhere = "WHERE tbltable1.[Field1] " & "" & Number1 & " " & _
    16. "AND tbltable1.[Field2] " & "" & Number2 & ";"
    17. Set db = CurrentDb
    18. Set rs = db.OpenRecordset(SQL & SQLWhere)
    19.  
    20. If rs.BOF = False And rs.EOF = False Then
    21. Msgbox "Test"
    22. End if
    Last edited by Pirre001; Aug 1st, 2002 at 02:57 AM.

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