Hi

Please can someone tell me what is wrong with this code, it id for my data report that is connected to a DataEnviroment, i use an access database and i the report is working but i am trying to report only on customer names that match the current date, but i keep getting errors.


VB Code:
  1. vb

Private Sub DataReport_Initialize()
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim sSQL As String
Set MyConn = New ADODB.Connection
Set MyRecSet = New ADODB.Recordset
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\quick-res\data\data.mdb;"
MyConn.Open
sSQL = "SELECT [Customer Name] FROM Guests Where [Arrival Date] = #" & Format(Date, "yyyy-mm-dd") & "#"

MyRecSet.Open sSQL, adOpenStatic, adLockReadOnly

Set DataReport1.DataSource = MyRecSet

MyConn.Close
MyRecSet.Close


End Sub

Please can someone advise me.

Many thanks