By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

a2k me.recordsource not taking

P: n/a
In what circumstances would assigning a recordsource to a report in the open
event not work?

I have this;

me.recordsource = strSQL

but the report is opening with no data! The recordsource is blank but this
was working fine a day ago!! I must have changed something but for the life
of me I can't see it. Stepping through the code doesn't produce any errors.

thanks
Martin
Nov 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Deano wrote:

In what circumstances would assigning a recordsource to a report in the open
event not work?
In the event that SQL returns no records, maybe?

Pavel

I have this;

me.recordsource = strSQL

but the report is opening with no data! The recordsource is blank but this
was working fine a day ago!! I must have changed something but for the life
of me I can't see it. Stepping through the code doesn't produce any errors.

thanks
Martin

Nov 12 '05 #2

P: n/a
Martin,

dumb question probably, but what happens if you paste the SQL into a
QBE grid and run it?
Nov 12 '05 #3

P: n/a
Pieter Linden wrote:
Martin,

dumb question probably, but what happens if you paste the SQL into a
QBE grid and run it?


It's looks good there and gives me the records I need. Just odd that the
very same SQL string doesn't get assigned as the recordsource of the report
anymore.
It must be something silly but I refuse to look at it til tomorrow morning,
it's doing my head in!
Nov 12 '05 #4

P: n/a
Pavel Romashkin wrote:
Deano wrote:

In what circumstances would assigning a recordsource to a report in
the open event not work?
In the event that SQL returns no records, maybe?


True.
Just hoping someone else had the same experience of not being able to assign
a recordsource for a reason that might be not normally be documented.

Pavel

I have this;

me.recordsource = strSQL

but the report is opening with no data! The recordsource is blank
but this was working fine a day ago!! I must have changed something
but for the life of me I can't see it. Stepping through the code
doesn't produce any errors.

thanks
Martin


Nov 12 '05 #5

P: n/a

Deano wrote:
In the event that SQL returns no records, maybe?


True.
Just hoping someone else had the same experience of not being able to assign
a recordsource for a reason that might be not normally be documented.


Try recreating the report. I found this to be the solution more than once.
When you step through the code do you actually see it assign the
recordsource? At the time it runs, create a DAO/ADO Rst with the same
SQL as the recordsource and check its recordcount to make sure it is
delivering what you expect. If yes, recreate the report.

Good luck,
Pavel
Nov 12 '05 #6

P: n/a
You can only reset the RecordSource of a Report in its Open event. If you've
moved the code to a different event, that could be the problem.

Larry Linson
Microsoft Access MVP

"Deano" <ma************@hotmail.com> wrote in message
news:_T*******************@wards.force9.net...
Pieter Linden wrote:
Martin,

dumb question probably, but what happens if you paste the SQL into a
QBE grid and run it?
It's looks good there and gives me the records I need. Just odd that the
very same SQL string doesn't get assigned as the recordsource of the

report anymore.
It must be something silly but I refuse to look at it til tomorrow morning, it's doing my head in!

Nov 12 '05 #7

P: n/a
Pavel Romashkin wrote:
Deano wrote:
In the event that SQL returns no records, maybe?


True.
Just hoping someone else had the same experience of not being able
to assign a recordsource for a reason that might be not normally be
documented.


Try recreating the report. I found this to be the solution more than
once. When you step through the code do you actually see it assign the
recordsource? At the time it runs, create a DAO/ADO Rst with the same
SQL as the recordsource and check its recordcount to make sure it is
delivering what you expect. If yes, recreate the report.

Good luck,
Pavel


Ah, this is stupid.
Just found out what the problem is. It's the way you enter the dates. If I
enter 10/01/2003 and 11/04/2003 it works.
But if I enter my dates in a dd/mm/yy format i.e 01/10/2003 (1st of October
2003) and 04/11/2003 (4th of November 2003) as I want (and need to) then
the date range covers 10th January to 11th April where there are no records,
hence my empty recordsource.

How do I fix this? Everything is set up with format of dd/mm/yy and i'm now
looking at functions to ensure the input dates are converted correctly but
no luck so far.


Nov 12 '05 #8

P: n/a
Deano wrote:
Pavel Romashkin wrote:
Deano wrote:
In the event that SQL returns no records, maybe?

True.
Just hoping someone else had the same experience of not being able
to assign a recordsource for a reason that might be not normally be
documented.


Try recreating the report. I found this to be the solution more than
once. When you step through the code do you actually see it assign
the recordsource? At the time it runs, create a DAO/ADO Rst with the
same SQL as the recordsource and check its recordcount to make sure
it is delivering what you expect. If yes, recreate the report.

Good luck,
Pavel


Ah, this is stupid.
Just found out what the problem is. It's the way you enter the
dates. If I enter 10/01/2003 and 11/04/2003 it works.
But if I enter my dates in a dd/mm/yy format i.e 01/10/2003 (1st of
October 2003) and 04/11/2003 (4th of November 2003) as I want (and
need to) then the date range covers 10th January to 11th April where
there are no records, hence my empty recordsource.

How do I fix this? Everything is set up with format of dd/mm/yy and
i'm now looking at functions to ensure the input dates are converted
correctly but no luck so far.


OK, further googling shows that I can work these things out own my own. The
internal way of addressing dates is mm/dd/yy (god bless them Yanks!). I
merely ensure my users can enter in dd/mm/yy and convert to American format
internally.
I now declare this thread dead.
Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.