Results 1 to 2 of 2

Thread: SQL Where and recordset

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Posts
    4

    SQL Where and recordset

    I am trying to set the where clause of a sql statment for creating a recordset based on the value in another recordset field and when i use the sql in an open recordset operation that i know is good i get an error. Simplified it looks like this

    SELECT field1 and field2 FROM table one
    WHERE field1 = rsRecordset.Field1

    Here is the entire statement
    strSQL = "SELECT tblDefectDetails.DefectDetail_ID, tblDefectDetails.DefectDetail_tblDefectReportID, tblDefectDetails.DefectDetail_Dimension, tblDefectDetails.DefectDetail_CondOth, tblDefectDetails.DefectDetail_Tolerance, tblDefectDetails.DefectDetail_Actual, tblDefectDetails.DefectDetail_InspectionReviewResult, tblDefectDetails.DefectDetail_InspectionReview_tblPersonnelID, tblDefectDetails.DefectDetail_Note" & _
    " From tblDefectDetails" & _
    " WHERE (((tblDefectDetails.DefectDetail_tblDefectReportID)= '" & rstDefectReport!DefectReport_ID & "'));"

    rstDefectReport is open, contains matching records, and is at first record
    rstDefectReport!DefectReport_ID contains a 3

    tblDefectDetails.DefectDetail_tblDefectReportID contains 2 records with a value of 3 so the resultant recordset should have those two records

    Where did i go wrong? the procedure that opens the recordset is ok because i use it multiple times in the program and this is the only instance where it gives me an error.
    do i need to use shaped recordsets?
    How can i accomplish this?

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Posts
    4
    got it on my own.. if i drop the opening and closing ' it works

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