My code is this.
Dim strSQL As String, strSQL2 As String
Dim db As Connection, rst As ADODB.Recordset
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\River Syde RMS\RiverSyde.mdb;"
strSQL = "SHAPE {SELECT * FROM Sales where Date1=#" & DTPicker3.Value & "#"
Set rst = New ADODB.Recordset
If rst.State = adStateOpen Then
rst.Close
End If
'db.Open
rst.CursorLocation = adUseClient
rst.LockType = adLockOptimistic
rst.CursorLocation = adUseClient
rst.CursorType = adOpenStatic
If rst.State = adStateOpen Then rst.Close
rst.Open strSQL, db, adOpenStatic, adLockOptimistic
Set DataReport1.DataSource = rst
With DataReport1.Sections("section1").Controls ' Group header section
.Item("Text1").DataField = "PayMode"
End With
With DataReport1.Sections("section1").Controls ' Detail section
.Item("text2").DataField = "Last Name"
End With
DataReport1.Show