473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Set Recordsource

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
2 2593
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
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 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...
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...
2
by: David Haskins | last post by:
I have a fairly complex interface screen (form) that is comprised of several subforms that perform different, but related activities. I am designing a search/filter form that should be able to...
8
by: bobh | last post by:
Hi All, Has anyone figured out how to reset the recordsource of a openned form?? ex: User opens a form, selects a value from combo1, selects a value from combo2, in the AfterUpdate event of...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.