hi all am trying to obtain a daily report from my database using the code below but it keeps giving me an error of false,when i say debug.print. when i say rptETR.show it gives me all the transactions and not the daily transactions.below is the code

Private Sub Cmddaily_Click()
Dim pubsql As String
    Getdata "Table1"
    pubsql = "SELECT * FROM table1 WHERE transaction_date " = "09/23/2010"
    Debug.Print pubsql

End Sub

can anyone please help me.
if u have an idea how i would go about showing the monthly and annual report please share it with me.
thanks in advance

Try the following by changing your sql statement -

'pubsql = "SELECT * FROM table1 WHERE transaction_date " = "09/23/2010" to

pubsql = "SELECT * FROM table1 WHERE transaction_date = DateValue('09/23/2010')

thanks Andre,
this seems to work since the error false is no longer there bt i still cannot see the report.when i replace the debug.print with rptetr.show it still displays the whole report,any suggestions on what might be wrong?
thanks

Try and set the report datasource after the new sql statement.

hi andre i tried this but am still getting the whole report

What report are you using? Is it DataReport? Crystal Report? Active Report?..

Have you set it as in?

Set DataReport.DataSource = MyRs.Recordset

Datareport.Show

thanks guys for ur help the sites were a great help i can now view my report as i wanted.

Only a pleasure. Happy coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.