Any ideas why Recordsource may have stopped working today?

D

DavidAtCaspian

Yesterday, I had a nice bit of code in a form, virtually the same as given by
Access (2002) help, that set a forms recordsource to find a particular record.
Nothing fancy in the code:

strSQL = "Select * from qRefCallHeader where cabreferrals.ubrn = '" &
Me.txtUBRN & "' "
Me.RecordSource = strSQL
(qrefcallheader is a query)

followed by:
a select case statement using me.recordset.recordcount

- I want to make sure there is only one record.
Worked fine yesterday.
Today wahtever I put in the strSQL statement, even if just the name of a
table: Or even if I just do

Me.RecordSource = "users"

me.recrodset.eof, me.recordset.bof are both true, and
me.recordset.recordcount is 0 (zero).

PLEASE: Any idea at all where I might look to find out why it isn't working
today???
I have done some changes, but am at a loss.
Access level is 10.6771.6804 SP3, and I have compacted/repaired and
compiled the application.

If I print the strSQL string in the debug window, copy and paste it into a
new query SQL window and run it, it does find the record OK. As far as I can
tell, "me.recordsource =" has just stopped working overnight

Thanks
 
D

Duane Hookom

Is the name of your table "users"? What happens if you try:
Me.RecordSource = "[users]"

I wouldn't use a table named users since I would fear that it is a
collection in Access. That's one of the reasons many of us create table
names like "tblUsers". Access likes it when we do that.
 
D

DavidAtCaspian

Thanks for the tip Duane. The table name was a red herring.

I found that even if I set the recordsource from the form property sheet ,
there were still no records found.
In the end it was a bizarre corruption in the form file itself.

Somehow a filter had got set which shut out everything, didn't say it was
filtered, and could not be displayed.

Quite by accident, I turned of the filter (on a straw grabbing effort), and
hey presto, all the records came back. (The word "filter" was nowhere in the
entire project).

At the same time, the porperty sheet of one of my lists had lost contact
with the code. (the on click property was blank, even though there was code
there)

So, in code I put
me.filter = ""
me.filteron = false.

This seemed to fix it, and the form is now working again with that code
removed.

Ever seen THAT before?????

David

Duane Hookom said:
Is the name of your table "users"? What happens if you try:
Me.RecordSource = "[users]"

I wouldn't use a table named users since I would fear that it is a
collection in Access. That's one of the reasons many of us create table
names like "tblUsers". Access likes it when we do that.

--
Duane Hookom
MS Access MVP

DavidAtCaspian said:
Yesterday, I had a nice bit of code in a form, virtually the same as given
by
Access (2002) help, that set a forms recordsource to find a particular
record.
Nothing fancy in the code:

strSQL = "Select * from qRefCallHeader where cabreferrals.ubrn = '" &
Me.txtUBRN & "' "
Me.RecordSource = strSQL
(qrefcallheader is a query)

followed by:
a select case statement using me.recordset.recordcount

- I want to make sure there is only one record.
Worked fine yesterday.
Today wahtever I put in the strSQL statement, even if just the name of a
table: Or even if I just do

Me.RecordSource = "users"

me.recrodset.eof, me.recordset.bof are both true, and
me.recordset.recordcount is 0 (zero).

PLEASE: Any idea at all where I might look to find out why it isn't
working
today???
I have done some changes, but am at a loss.
Access level is 10.6771.6804 SP3, and I have compacted/repaired and
compiled the application.

If I print the strSQL string in the debug window, copy and paste it into
a
new query SQL window and run it, it does find the record OK. As far as I
can
tell, "me.recordsource =" has just stopped working overnight

Thanks
 
D

Duane Hookom

I can't recall experiencing the phantom philter issue before.

--
Duane Hookom
MS Access MVP

DavidAtCaspian said:
Thanks for the tip Duane. The table name was a red herring.

I found that even if I set the recordsource from the form property sheet ,
there were still no records found.
In the end it was a bizarre corruption in the form file itself.

Somehow a filter had got set which shut out everything, didn't say it was
filtered, and could not be displayed.

Quite by accident, I turned of the filter (on a straw grabbing effort),
and
hey presto, all the records came back. (The word "filter" was nowhere in
the
entire project).

At the same time, the porperty sheet of one of my lists had lost contact
with the code. (the on click property was blank, even though there was
code
there)

So, in code I put
me.filter = ""
me.filteron = false.

This seemed to fix it, and the form is now working again with that code
removed.

Ever seen THAT before?????

David

Duane Hookom said:
Is the name of your table "users"? What happens if you try:
Me.RecordSource = "[users]"

I wouldn't use a table named users since I would fear that it is a
collection in Access. That's one of the reasons many of us create table
names like "tblUsers". Access likes it when we do that.

--
Duane Hookom
MS Access MVP

message
Yesterday, I had a nice bit of code in a form, virtually the same as
given
by
Access (2002) help, that set a forms recordsource to find a particular
record.
Nothing fancy in the code:

strSQL = "Select * from qRefCallHeader where cabreferrals.ubrn = '" &
Me.txtUBRN & "' "
Me.RecordSource = strSQL
(qrefcallheader is a query)

followed by:
a select case statement using me.recordset.recordcount

- I want to make sure there is only one record.
Worked fine yesterday.
Today wahtever I put in the strSQL statement, even if just the name of
a
table: Or even if I just do

Me.RecordSource = "users"

me.recrodset.eof, me.recordset.bof are both true, and
me.recordset.recordcount is 0 (zero).

PLEASE: Any idea at all where I might look to find out why it isn't
working
today???
I have done some changes, but am at a loss.
Access level is 10.6771.6804 SP3, and I have compacted/repaired and
compiled the application.

If I print the strSQL string in the debug window, copy and paste it
into
a
new query SQL window and run it, it does find the record OK. As far as
I
can
tell, "me.recordsource =" has just stopped working overnight

Thanks
 

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

Top