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

sourceobject set to nothing problem in forms

P: n/a
Hello.

I am using MS Access 97 at work and trying to do the following...
I have a main form which has several combo boxes, 2 buttons (search and
refresh) and an unbound subform on it. This form acts like a search
screen, searching thru a bunch of records using the combo selections as
filters. The search runs when the user makes some selections and then
clicks the search button.

I decided to use the unbound subform for performance reasons. The
sourceobject of the subform is set on the search click event, after the
SQL is assembled that drives the subform.
This all works fine.However...

when I am trying to reset the sourceobject to nothing to clear the
screen (refresh button clears all combo selections and should blank out
subform entirely to prep for another search)
I am getting errors.I am trying to do all this on the click event of
the refresh button which is a control of the search screen so I am
referencing the subform control as

me.mysubformname.sourceobject=nothing

I get an error using the above syntax. I also tried
me.mysubformname.sourceobject=null or
me.mysubformname.sourceobject=""

I also tried closing the referenced subform before setting the
sourceobkect, with no success.
The task is simple, I need to clear the subform when the user clicks
'refresh'. Could anyone let me know why this is not working?

Thanks
JW

Apr 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 18 Apr 2006 21:01:07 -0700, "joanWilder" <kj*****@rogers.com>
wrote:

You have talent as a suspense writer. Everyone is asking when you will
reveal what error you are getting :-)

I ran the Northwind sample application, opened the Orders form, and
executed this line in the Immediate window:
Forms!Orders![Orders Subform].SourceObject = ""
It worked as expected. How is your code different?

-Tom.
Hello.

I am using MS Access 97 at work and trying to do the following...
I have a main form which has several combo boxes, 2 buttons (search and
refresh) and an unbound subform on it. This form acts like a search
screen, searching thru a bunch of records using the combo selections as
filters. The search runs when the user makes some selections and then
clicks the search button.

I decided to use the unbound subform for performance reasons. The
sourceobject of the subform is set on the search click event, after the
SQL is assembled that drives the subform.
This all works fine.However...

when I am trying to reset the sourceobject to nothing to clear the
screen (refresh button clears all combo selections and should blank out
subform entirely to prep for another search)
I am getting errors.I am trying to do all this on the click event of
the refresh button which is a control of the search screen so I am
referencing the subform control as

me.mysubformname.sourceobject=nothing

I get an error using the above syntax. I also tried
me.mysubformname.sourceobject=null or
me.mysubformname.sourceobject=""

I also tried closing the referenced subform before setting the
sourceobkect, with no success.
The task is simple, I need to clear the subform when the user clicks
'refresh'. Could anyone let me know why this is not working?

Thanks
JW


Apr 19 '06 #2

P: n/a
rkc
joanWilder wrote:
Hello.

I am using MS Access 97 at work and trying to do the following...
I have a main form which has several combo boxes, 2 buttons (search and
refresh) and an unbound subform on it. This form acts like a search
screen, searching thru a bunch of records using the combo selections as
filters. The search runs when the user makes some selections and then
clicks the search button.

I decided to use the unbound subform for performance reasons. The
sourceobject of the subform is set on the search click event, after the
SQL is assembled that drives the subform.
This all works fine.However...

when I am trying to reset the sourceobject to nothing to clear the
screen (refresh button clears all combo selections and should blank out
subform entirely to prep for another search)
I am getting errors.I am trying to do all this on the click event of
the refresh button which is a control of the search screen so I am
referencing the subform control as

me.mysubformname.sourceobject=nothing


Try setting the sourceobject to a valid sql statement/saved query
that returns an empty result.




Apr 19 '06 #3

P: n/a
rkc <rk*@rochester.yabba.dabba.do.rr.bomb> wrote in
news:BQ*****************@twister.nyroc.rr.com:
Try setting the sourceobject to a valid sql statement/saved query
that returns an empty result.


Huh? Sourceobject is the name of a subform or a zero-length string.

There is no reason why setting it to "" should fail.

I don't quite understand why one doesn't leave the subform alone and
just set its recordsource, but it's not my application.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 19 '06 #4

P: n/a
rkc
David W. Fenton wrote:
rkc <rk*@rochester.yabba.dabba.do.rr.bomb> wrote in
news:BQ*****************@twister.nyroc.rr.com:
Try setting the sourceobject to a valid sql statement/saved query
that returns an empty result.

Huh? Sourceobject is the name of a subform or a zero-length string. There is no reason why setting it to "" should fail.

I don't quite understand why one doesn't leave the subform alone and
just set its recordsource, but it's not my application.


Probably what I was thinking when I answered wrong. Or not.

I have seen quite a few applications lately where a single
navigation/menu parent form stays open all the time and forms
are switched in and out of one or more subform controls. Mostly
where an attempt is being made to have an Outlook type menu bar
on the left side of the screen.


Apr 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.