Why is my "continuous form" subform not working right?

F

Forstatd

I have developed a small application in Access 2002 that has worked good for
a couple of years. Now the client wants me to modify the data entry form to
allow the user to enter data in a simpler way. The recordsource for this
form is a table called "BIDDERS". I am attempting to create a subform on the
master form that is set to to display a few controls on a "continuous form"
that is also using the same recordsource "BIDDERS". On the master form I
have a command button that when clicked, expands the size of the subform to
cover the entire master form with this simpler data set...and by clicking
another command button I can hide this subform so the user can see and use
the very detailed master form, if the so desire (this part works
beautifully). However when the subform is up/displayed, it only shows one
record on the continuous form... the exact record that the master form is on
at any given time.

When I open the subform by itself I see all the records, but when I display
the subform within the master form, I only see one record. If I disconnect
the master form from the BIDDERS table the continuous subform works/displays
perfectly. What am I doing wrong??

Hope this make sense to someone
 
D

Dirk Goldgar

Forstatd said:
I have developed a small application in Access 2002 that has worked good
for
a couple of years. Now the client wants me to modify the data entry form
to
allow the user to enter data in a simpler way. The recordsource for this
form is a table called "BIDDERS". I am attempting to create a subform on
the
master form that is set to to display a few controls on a "continuous
form"
that is also using the same recordsource "BIDDERS". On the master form I
have a command button that when clicked, expands the size of the subform
to
cover the entire master form with this simpler data set...and by clicking
another command button I can hide this subform so the user can see and use
the very detailed master form, if the so desire (this part works
beautifully). However when the subform is up/displayed, it only shows one
record on the continuous form... the exact record that the master form is
on
at any given time.

When I open the subform by itself I see all the records, but when I
display
the subform within the master form, I only see one record. If I
disconnect
the master form from the BIDDERS table the continuous subform
works/displays
perfectly. What am I doing wrong??

Hope this make sense to someone


I can't say for sure, but it sounds as though the subform is linked to the
main form via its Linknk Master Fields and Link Child Fields properties. In
this case, you want those properties to be empty, so that there is no
linkage between the subform and the form.
 
F

Forstatd

Thanks for the quick reply. That was the first thing I checked for when this
didn't work. Nothing is in the link master/child properties at all.....
anywhere else to look to resolve this?
 
D

Dirk Goldgar

Forstatd said:
Thanks for the quick reply. That was the first thing I checked for when
this
didn't work. Nothing is in the link master/child properties at all.....
anywhere else to look to resolve this?


Check the recordsource of the subform, make sure it isn't a query that uses
the main form as a filter criterion. Check the filter property of the
subform, make sure its blank. Check your code in the command button that
expands the subform, to make sure it doesn't filter the subform. Look for
any code in the main or subform that modifies its RecordSource or Filter
properties, or that uses the ApplyFilter method.
 
F

Forstatd

No query involved on the mainform or subform, no filter is being used, or
applied at all on either form...nothing is modifiying the underlying
recordsource on either form....or in the code.... as far as I can see...
 
D

Dirk Goldgar

Forstatd said:
No query involved on the mainform or subform, no filter is being used, or
applied at all on either form...nothing is modifiying the underlying
recordsource on either form....or in the code.... as far as I can see...


Would you be interested in having me look at it? If you'd like to send me a
cut-down copy of your database, containing only the elements necessary to
demonstrate the problem, compacted and then zipped to less than 1MB in size
(preferably much smaller) -- I'll have a look at it, time permitting. You
can send it to the address derived by removing NO SPAM and ".invalid" from
the reply address of this message. If that address isn't visible to you,
you can get my address from my web site, which is listed in my sig. Do
*not* post my real address in the newsgroup -- I don't want to be buried in
spam and viruses.
 
F

Forstatd

Thanks so much for your suggestions. I may have found something.....

My subform's recordsource was only being assigned the recordsource "BIDDERS"
when the "VIEW" command button was clicked... I was doing this on the fly, so
to speak. I just now addedd "BIDDERS" to the subform's record source....so
now when I open the master form, and click the command button (all it does
now is to make the subform visible) ....it works....

Does this make sense that the recordsource for a continuous form must be
identified before it is opened?
 
D

Dirk Goldgar

Forstatd said:
Thanks so much for your suggestions. I may have found something.....

My subform's recordsource was only being assigned the recordsource
"BIDDERS"
when the "VIEW" command button was clicked... I was doing this on the fly,
so
to speak.

So you were mistaken before when you said:
No query involved on the mainform or subform, no filter is being used, or
applied at all on either form...nothing is modifiying the underlying
recordsource on either form....or in the code.... as far as I can see...

This is exactly what I asked you check.
I just now addedd "BIDDERS" to the subform's record source....so
now when I open the master form, and click the command button (all it does
now is to make the subform visible) ....it works....

Does this make sense that the recordsource for a continuous form must be
identified before it is opened?

No, not at all -- you can certainly assign the recordsource to a form or
subform dynamically. I think there must be something else that you were
inadvertently doing to filter the recordsource. What was the original code
that was assigning the subform's RecordSource property?
 
J

John W. Vinson

Does this make sense that the recordsource for a continuous form must be
identified before it is opened?

Yes.

If the form has no recordsource at the time that it is opened, it will of
course be blank until a recordsource is assigned; and if you're doing so it
will probably be necessary to refresh or repaint the form to see the data.

Maybe I'm misunderstanding the situation...
 
D

Dirk Goldgar

John W. Vinson said:
Yes.

If the form has no recordsource at the time that it is opened, it will of
course be blank until a recordsource is assigned; and if you're doing so
it
will probably be necessary to refresh or repaint the form to see the data.

I don't think you'd have to do that.
Maybe I'm misunderstanding the situation...

The issue here is that Forstatd has said that the subform opens as if linked
to the main form -- not blank or empty, but showing related records. That
wouldn't happen if the subform's recordsource is blank.
 
D

Dirk Goldgar

Forstatd said:
Thanks so much for your suggestions. I may have found something.....

My subform's recordsource was only being assigned the recordsource
"BIDDERS"
when the "VIEW" command button was clicked... I was doing this on the fly,
so
to speak. I just now addedd "BIDDERS" to the subform's record
source....so
now when I open the master form, and click the command button (all it does
now is to make the subform visible) ....it works....

Does this make sense that the recordsource for a continuous form must be
identified before it is opened?


Having looked at the cut-down version of the database you sent me to
examine, I see what's going on. You posted that you were changing the
subform's RecordSource at run time, but that is not the case. Instead, you
are changing the subform's SourceObject property. When you do that, Access
"helpfully" sets the Link Master Fields and Link Child Fields properties to
what it thinks they should be, based on the relationship between the two
forms' recordsources. So although the subform did not have the Link Master
& Child Fields properties set in design view, every time you changed the
SourceObject at run time, they were set automatically by Access.

I've sent you a revised version in which I've put a little code to only set
the subform's SourceObject the first time the View button is clicked, and to
clear the Link Master & Child Fields immediately afterward. That works for
what you've described so far.

However, it may or may not be what you really want to be doing. It could be
that you have no need to dynamically set the SourceObject at all, but only
need to set the RecordSource of the subform. You would do that with code
along these lines:

Me.Sub_Form.Form.RecordSource = ...

But since I don't know exactly what you have in mind, I can't advise you
further on that. The main lessons to take away are:

(1) The SourceObject property of a subform control is not at all the same
thing as the subform's RecordSource, and

(2) If you change the SourceObject property of a subform control, you need
to also set or clear the Link Master Fields and Link Child Fields
properties, because you don't know for sure Access will automatically set
them to.
 

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