Results 1 to 2 of 2

Thread: Data Report Problem?????????Need Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    2

    Unhappy Data Report Problem?????????Need Help

    I cant get the data report RS to refresh its query. Here is the peace of code:

    Private Sub PrintReport_Click()
    Dim strSql As String

    If Combo1.Text <> "-- Select One --" And Combo2.Text <> "--Select One --" And Combo3.Text <> "-- Select One --" Then
    If Combo3.Text = "TrackingNumber" Then
    strSql = "SELECT * FROM tblReports WHERE RepDate='#" & Combo2.Text & "#' AND Type='" & Combo1.Text & "' ORDER BY PaperId"
    Else
    strSql = "SELECT * FROM tblReports WHERE RepDate='#" & Combo2.Text & "#' AND Type='" & Combo1.Text & "' ORDER BY " & Combo3.Text
    End If
    If DataEnvironment1.rssqlReports.state = adStateOpen Then
    DataEnvironment1.rssqlReports.Close
    End If
    DataEnvironment1.Commands(2).CommandText = strSql
    DataEnvironment1.sqlReports
    DataReport3.Refresh
    DataReport3.Show
    'Unload DataReport3
    Else
    MsgBox "Plese make your selections", vbInformation
    Exit Sub
    End If
    End Sub
    Dan

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374
    Try this:

    Dim strConnectString as String
    Dim strSQL as String
    Dim sCaptionString As String
    strConnectString = "..........."
    '(If different to default)
    strSQL = "SELECT ...... FROM............"
    sCaptionString = "................"
    Set DataEnvironment1 = Nothing
    DataEnvironment1.Connection1.ConnectionString = strConnectString
    DataEnvironment1.rsqryQuery1.Open strSql

    Report1.Sections("Section4").Controls("Label1").Caption = sCaptionString
    '(If you want to change label caption at run time)

    Report1.Refresh
    Report1.Show
    DataEnvironment1.rsqryQuery1.Close
    Set DataEnvironment1 = Nothing

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