473,466 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

a2k me.recordsource not taking

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
8 3449
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
Martin,

dumb question probably, but what happens if you paste the SQL into a
QBE grid and run it?
Nov 12 '05 #3
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
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

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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jenny Kurniawan | last post by:
I have a procedure that goes like this: Private Sub Form_Current() Dim strSQL1 As String strSQL1 = "Select Price_Year_Name from Price_Year where Category_ID = 1 And By_Default <> 0" ' I...
2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
4
by: ColinWard | last post by:
Hi. I use two different pieces of code to manipulate a recordsource for a form. The first one sets the recordsource to null when the form loads. The second is supposed to display the corresponding...
1
by: CSDunn | last post by:
Hello, In an Access 2003 Project that uses a SQL Server 2000 database as its data source, I am attempting to set the RecordSource property of a sub report called 'RptTeacherHistory2' that appears...
6
by: Not Me | last post by:
Hi, I have a stored procedure as a recordsource for a form, taking a parameter from another form, it displays records that are already present without any problems. I had to add a resync...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
9
by: robert d via AccessMonster.com | last post by:
I'm not sure why the following isn't working. The subform loads correctly, but no data is displayed. I'm certain that there is data and I have checked that the SQL statement does in fact return...
2
by: G Gerard | last post by:
Hello I have noticed that whenever I set a form's RecordSource property in code it launches the form's OnActivate event. In one of my application I set a form's RecordSource to zero lenght...
3
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RecordSource of a Master Report is: Me.RecordSource = "TableOrQueryName"
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.