Results 1 to 9 of 9

Thread: Date & ADO **RESOLVED**

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Date & ADO **RESOLVED**

    Why does this not work?
    With Debug firstDate & lastDate are correct but the SQL statement does not return any values, and I know they are there.
    Please help.
    VB Code:
    1. Dim firstDate As Date
    2.         Dim lastDate As Date
    3.        
    4.         myChart.Row = 1
    5.         firstDate = myChart.RowLabel
    6.        
    7.         myChart.Row = myChart.RowCount
    8.         lastDate = myChart.RowLabel
    9.        
    10.         'Get and print history
    11.         cnnCon.Open dataText
    12.         rsRes.Open "SELECT Date, Result, SampleComments.Comment " & _
    13.                    "FROM SampleResults, SampleComments " & _
    14.                    "WHERE SampleResults.ID = SampleComments.ID " & _
    15.                    "AND SampleResults.TestName = " & Chr(34) & _
    16.                    cboTest.Text & Chr(34) & _
    17.                    " AND Date >= " & firstDate & _
    18.                    " AND Date <= " & lastDate & _
    19.                    " ORDER BY Date", _
    20.                    cnnCon, _
    21.                    adOpenKeyset, _
    22.                    adLockReadOnly, _
    23.                    adCmdText
    24.                    
    25.         With rsRes
    26.             If (Not (.BOF And .EOF)) Then
    27.                 .MoveFirst
    28.                 While (Not .EOF)
    29.                     Printer.Print "Date: " & .Fields("Date").Value & _
    30.                                   "  Result: " & .Fields("Result").Value & vbTab & _
    31.                                   "  Comment: " & .Fields("Comment").Value
    32.                     .MoveNext
    33.                 Wend
    34.             End If
    35.         End With
    36.        
    37.         rsRes.Close
    38.         cnnCon.Close
    Last edited by GlenW; Apr 8th, 2002 at 09:18 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