help with code

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi

I am trying to change the recordsource of a report in the onopen event.

A part of the code is below, I am trying to process only the records from
today onwards, It works in the query but it shows all records when the
report is opened.

Thanks in advance for your help

Richard

Me.Report.RecordSource = "SELECT ......... " & _
"WHERE (((Enrolments.WORKSHOPDATE)>= " & Date & ") AND
((Enrolments.Cancelled)=False)) " & _
"ORDER BY Enrolments.WORKSHOPDATE DESC;"
 
When the date is concatenated into the string, it needs to be delimited with
#.

If you are working in a non-US country, you also need to specify the
American date format.

Try:
Me.Report.RecordSource = "SELECT ......... " & _
"WHERE (((Enrolments.WORKSHOPDATE)>= " & Format(Date,
"\#mm\/dd\/yyyy\#") & _
") AND ((Enrolments.Cancelled)=False)) " & _
"ORDER BY Enrolments.WORKSHOPDATE DESC;"
 
Thanks Allen




Allen Browne said:
When the date is concatenated into the string, it needs to be delimited with
#.

If you are working in a non-US country, you also need to specify the
American date format.

Try:
Me.Report.RecordSource = "SELECT ......... " & _
"WHERE (((Enrolments.WORKSHOPDATE)>= " & Format(Date,
"\#mm\/dd\/yyyy\#") & _
") AND ((Enrolments.Cancelled)=False)) " & _
"ORDER BY Enrolments.WORKSHOPDATE DESC;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top