Thanks for the repsonses guys.
Jack, i tried your code but im not sure if i have it working properly at the
moment. It seems to sort of work but still only searches the current record.
I think im using the wrong subform control name. I am new to access and not
100% sure what this might be. You say it is not supposed to be the subforms
name but rather its the name of the control that conatins the subform. Do you
mean the name of the main form that contains the subform?
Allen, thanks for pointing me towards your example. Your website has been
very useful for setting up my data base thus far. Unfortunately in this case
the way my form is set up means that the given example would be an unsuitable
way of filtering my data as users need to be able to enter as well as
retrieve data from the same form.
Basically, my subform is linked to a table named "contacts" and users can
input data to the subform who's info is subsequently stored in this table.
The subform is in the "details" section of my mainform and stores contact
details such as names and phone numbers specific to individual workers at a
particular company.
In the mainform header i have a seperate group of parameters whos details
are stored in a seperate table named "customers". This stores details
relevant to all workers at that company and other info such as delivery
adress etc. So essentially for each record, i have a mainform header that
provides general info for that company, and then a subform that displays
contact details for workers at that company. The contacts details and the
company details are linked using a "Customer_ID" key.
So as you can see i am in a pickle. I need to be able to use the same form
to input my data, but also search using a control on the mainform header. Its
difficult to explain but essentially, the find next function does exactly
what i want, but it will only search the current record (i.e. only the
contacts with the Customer_ID number specific to that record) and i cannot
find a way to configure my filters to do what i want.
Thanks for helping me out thus far though. I am willing to try anything
suggested and am determined to get this to work.
Cheers,
Dave.
Allen Browne said:
Dave, take a look at this article:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
There's a sample database you can download (free), and pull apart to see how
it works. Essentially, it's a continuous form with unbound boxes in the Form
Header section where you enter your filter values, and it displays the
results (one per row) in the continuous form.
It is possible to use a subform, but it's not really necessary. If you had a
subform control named Child1, you would set its filter with code like this:
Me.[Child1].Form.Filter = strWhere
Me.[Child1].Form.FilterOn = True
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
DavidG said:
Hi, I was just wondering how to go about searching for a certain parameter
within a subform using a control on the mainform? I basically want to be
able
to have the same search features as the "find next" command, i.e. when the
search name is matched the record containing the match is displayed in
full
Filters tend to remove the other information from the record (i have
multiple contact names and details for each record) but im still wondering
if
there is a way to acheive the desired outcome using filters. The main
problem
is being able to use the control on the mainform as my subform has to be
displayed in tabular form.
Any help would be greatly appreciated.
Thanks,
Dave.
.