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

Set Recordsource

P: n/a
EJO
Using a tab control, I am setting the recordsource value of a form
using the following code (both the form filter property and the subform
link child/master fields are not used):

***********************************
Private Sub TabCtl37_Change()

Dim SRrecordset

Select Case Me.TabCtl37.Value
Case 0
SRrecordset = "SELECT * From SRtbl WHERE
(((SiteCode)=[Forms]![Site].[Form]![SiteCode]) AND ((Cancelled)=False)
AND ((Accept_Act) Is Null)) ORDER BY SR_Entered_Act;"
Me.RecordSource = SRrecordset
Case 1
SRrecordset = "SELECT * From SRtbl WHERE
(((SiteCode)=[Forms]![Site].[Form]![SiteCode]) AND (((Cancelled)=True)
OR ((Accept_Act) Is Not Null))) ORDER BY Install_Act;"
Me.RecordSource = SRrecordset
Case 2
SRrecordset = "SELECT * From SRtbl ORDER BY SR;"
Me.RecordSource = SRrecordset
End Select

End Sub
************************************************** *******

Case 2 is not working. There seems to be a hang up in the form that
forces it to filter based on the SiteCode field--though it is only used
in the form from the above sql statements. Can someone give me some
insight as to why the explicit recordsource is being ignored? The
exact same code is in a compiled mde released version in my user base
and is working fine. (this is not the first time that i have noticed
that code that works one day all of a sudden stops working despite no
changes to that code.)

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
EJO wrote:
< SNIP >
The
exact same code is in a compiled mde released version in my user base
and is working fine. (this is not the first time that i have noticed
that code that works one day all of a sudden stops working despite no
changes to that code.)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Be sure you've compiled & save the code.

I've found that sometimes it is necessary to set a breakpoint in the
code & then step thru it before it "works." Strange, but true.

Set the breakpoint at the Sub/Function declaration line. Run the
event/procedure. Step thru. See if the Tab's Value is OK. Continue
stepping thru until the end of the Sub/Function. The Sub/Function works
as you expected.

Remove the breakpoint & run the event/procedure again. This time it
works! Weird.

If that doesn't solve the problem - it's something else I don't know
about.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQtQdeYechKqOuFEgEQKWtQCcDUZxodjmOK8/8gIhJbGs1uAT5EwAoObb
ff961iaBbruGj56fjbA9PWlz
=AgD1
-----END PGP SIGNATURE-----
Nov 13 '05 #2

P: n/a
EJO
Thanks, much for the try MGFoster. I did as you indicated and do not
see that the form's recordsource is anything other than expected. That
leads me to believe there is some other element, not in code, that is
preventing the form from displaying data.

I don't know whether there is a parent/child relationship that is
overriding the recordsource, but how can I check?

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.