Results 1 to 12 of 12

Thread: Whats wrong with this SQL query?

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665

    Question Whats wrong with this SQL query?

    This query doesen't work. Please, help me...

    VB Code:
    1. Dim db As Database
    2. Dim rs As Recordset
    3. Dim SQL, SQLWhere, Number1, Number2
    4.  
    5. If Len(Me![Text0]) > 0 Then
    6. Number1 = "=""" & Me![Text0] & """"
    7. Else
    8. Number1 = "Is Null"
    9. End If
    10.  
    11. If Len(Me![Text1]) > 0 Then
    12. Number2 = "="""  & Me![Text1] & """"
    13. Else
    14. Number2 = "Is Null"
    15. End If
    16.  
    17. SQL = "SELECT * FROM tbltable1 "
    18.  
    19. SQLWhere = "WHERE tbltable1.[Field1] " & "" & Number1 & " " & _
    20. "AND tbltable1.[Field2] " & "" & Number2 & ";"
    21.  
    22. Set db = CurrentDb
    23. Set rs = db.OpenRecordset(SQL & SQLWhere)
    Last edited by Pirre001; Jul 31st, 2002 at 06:19 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