> 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
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
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
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
>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/
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.
So will the problem occur if i do it the way you suggested?
>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
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.
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.
>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