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