Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Blank the rowsource of a sub-form - Urgent

24 views
Skip to first unread message

Arlette

unread,
Nov 2, 2009, 4:49:58 AM11/2/09
to
I have tried several things but am not able to blank out the rowsource
of a sub-form when the form closes. Please help. Its urgent.

Randy Yates

unread,
Nov 2, 2009, 7:39:16 AM11/2/09
to
Arlette <arlette...@gmail.com> writes:

> I have tried several things but am not able to blank out the rowsource
> of a sub-form when the form closes. Please help. Its urgent.

Why in the world do you think you need to do such a thing? When you
close a form, the subform closes also without any special action
required.
--
Randy Yates % "...the answer lies within your soul
Digital Signal Labs % 'cause no one knows which side
mailto://ya...@ieee.org % the coin will fall."
http://www.digitalsignallabs.com % 'Big Wheels', *Out of the Blue*, ELO

Arlette

unread,
Nov 2, 2009, 7:46:04 AM11/2/09
to
Ok let me explain why i need it. The form in question is a search
form. The main form contains a text box for the search field and a
search button. The results will be displayed in a sub-form. When i
run the form, the sub form shows as a blank screen. When i key in the
search field into the text box, the search appears. But i would also
want to put in a clear button so that the user can clear the search
and start another. Hence, i was suggested by a friend to clear the
recordsource. But i am not able to do it.
Also when i run the form for the 1st time, it shows blank (as said
above). However, if close and run again, the previous search results
appear. Instead, i want it to be a blank form (with only headers and
blank fields) to appear each time the subform loads.

jbguernsey

unread,
Nov 2, 2009, 9:12:01 AM11/2/09
to

Hi Arlette
Question ... When you 'search' using the contents of the text box are
you actually setting the recordsource of the subform using the text
box as a criterion or are you filtering an existing recordsource
using the text box or is the master/child link using the parent form
text box? All 3 ways will result in the subform displaying the
desired rows. What happens next may well depend on how you are
'filtering'.
JB

Arlette

unread,
Nov 2, 2009, 10:46:25 AM11/2/09
to
Hi there, yes, i am setting the recordsource of the subform using the
text box as a criterion in the query. But i am not able to blank out
the form before any search happens.

jbguernsey

unread,
Nov 2, 2009, 11:07:03 AM11/2/09
to

Ok, so (I presume) in the After Update event of the text box on the
parent form you have something like
Forms!frmMySubForm!Control.Form.recordsource = "MyQuery"

or perhaps

Forms!frmMySubForm!MySubFormControl.Form.recordsource = "SELECT * from
tblMyTable WHERE [MyField] = chr(34) & MyTextBox & chr(34)

When the After Update event is triggered the Subform will be requeried
automatically and will display new rows.

Am I correct?

JB

jbguernsey

unread,
Nov 2, 2009, 11:09:29 AM11/2/09
to

Oops - left out speech marks and & ...

Forms!frmMySubForm!MySubFormControl.Form.recordsource = "SELECT * from
tblMyTable WHERE [MyField] = chr(34) & MyTextBox & chr(34)

should be

Forms!frmMySubForm!MySubFormControl.Form.recordsource = "SELECT * from

tblMyTable WHERE [MyField] =" & chr(34) & MyTextBox & chr(34)

air code is always dicey!

JB

Tony Toews [MVP]

unread,
Nov 2, 2009, 4:53:57 PM11/2/09
to
Arlette <arlette...@gmail.com> wrote:

>Ok let me explain why i need it. The form in question is a search
>form. The main form contains a text box for the search field and a
>search button. The results will be displayed in a sub-form.

For search forms I just use a continuous form with the search text in the header. No
subforms.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/

Arlette

unread,
Nov 4, 2009, 12:26:57 AM11/4/09
to
On Nov 3, 2:53 am, "Tony Toews [MVP]" <tto...@telusplanet.net> wrote:

> Arlette <arlette.deso...@gmail.com> wrote:
> >Ok let me explain why i need it.  The form in question is a search
> >form.  The main form contains a text box for the search field and a
> >search button. The results will be displayed in a sub-form.  
>
> For search forms I just use a continuous form with the search text in the header.  No
> subforms.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages -http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/

> For a free, convenient utility to keep your users FEs and other files
>   updated seehttp://www.autofeupdater.com/
> Granite Fleet Managerhttp://www.granitefleet.com/

Tony, i had initially used a continuous form itself with a search text
at the top of the form (i didnt put it in the header though i can try
that). But i observed, that if i just scroll with the mouse while the
form is active, the records would start scrolling too. IF i was on the
1st record, i would just by scrolling reach the 5th or 6th record. I
didnt want that to happen so i created the subform.

Arlette

unread,
Nov 4, 2009, 9:45:18 AM11/4/09
to
> didnt want that to happen so i created the subform.- Hide quoted text -
>
> - Show quoted text -

So will the problem occur if i do it the way you suggested?

Tony Toews [MVP]

unread,
Nov 6, 2009, 1:53:24 AM11/6/09
to
Arlette <arlette...@gmail.com> wrote:

>Tony, i had initially used a continuous form itself with a search text
>at the top of the form (i didnt put it in the header though i can try
>that). But i observed, that if i just scroll with the mouse while the
>form is active, the records would start scrolling too. IF i was on the
>1st record, i would just by scrolling reach the 5th or 6th record. I
>didnt want that to happen so i created the subform.

Sorry, I don't understand your problem. Was it that you would start scrolling and
Access would keep on scrolling even when you had stopped? If this is Access 2007
then there's a hotfix for that problem.

http://msmvps.com/blogs/access/archive/2009/08/31/eagerly-anticipated-access-2007-hotfix.aspx

Tony
--
Tony Toews, Microsoft Access MVP

Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/


For a free, convenient utility to keep your users FEs and other files

Arlette

unread,
Nov 11, 2009, 12:21:19 AM11/11/09
to
On Nov 6, 11:53 am, "Tony Toews [MVP]" <tto...@telusplanet.net> wrote:

> Arlette <arlette.deso...@gmail.com> wrote:
> >Tony, i had initially used a continuous form itself with a search text
> >at the top of the form (i didnt put it in the header though i can try
> >that).  But i observed, that if i just scroll with the mouse while the
> >form is active, the records would start scrolling too. IF i was on the
> >1st record, i would just by scrolling reach the 5th or 6th record.  I
> >didnt want that to happen so i created the subform.
>
> Sorry, I don't understand your problem.   Was it that you would start scrolling and
> Access would keep on scrolling even when you had stopped?  If this is Access 2007
> then there's a hotfix for that problem.
>
> http://msmvps.com/blogs/access/archive/2009/08/31/eagerly-anticipated...

>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages -http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/

> For a free, convenient utility to keep your users FEs and other files
>   updated seehttp://www.autofeupdater.com/
> Granite Fleet Managerhttp://www.granitefleet.com/

No, what i meant was...if i had included the search field and the rest
of the fields in the detail section of the form, whenever i scroll
using the mouse, the records would scroll too. I dont want that to
happen. Ideally, i just need it that the user keys in the value in the
search field and then the records are displayed in the rest of the
form.

hbinc

unread,
Nov 11, 2009, 4:23:39 AM11/11/09
to

Hi Arlette,

Is it possible to run a query that result in 0 records, e.g. with Id =
0, so that the subform blanks out before the next search?

HBInc.

Tony Toews [MVP]

unread,
Nov 11, 2009, 5:02:25 PM11/11/09
to
Arlette <arlette...@gmail.com> wrote:

>No, what i meant was...if i had included the search field and the rest
>of the fields in the detail section of the form, whenever i scroll
>using the mouse, the records would scroll too. I dont want that to
>happen. Ideally, i just need it that the user keys in the value in the
>search field and then the records are displayed in the rest of the
>form.

Search fields should go in the form header. The records in the continuous form
detail section.

Tony
--
Tony Toews, Microsoft Access MVP

Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/


For a free, convenient utility to keep your users FEs and other files

0 new messages