Subform Searching

A

Access Newbie

I have an access database in which a subform has been placed into a mainform. I have added the default Find button to my main form, but it only successfully searches the main form. When I click a field in the subform, and click Find, it does not find anything in the database, although I know it is there. Please help!!!!
 
A

Allen Browne

Typically, a subform contains only records that relate to the record in the
main form. If that is so, then finding a record in the subform is a matter
of finding the right record in the main form first, and then moving to the
desired record in the subform.

There is a bit of code involved, but it follows these steps:
1. Use DLookup() to find the value of the foreign key in the subform's
table.

2. Find the record with that primary key value in the main form.

3. Move the subform to the desired record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Access Newbie said:
I have an access database in which a subform has been placed into a
mainform. I have added the default Find button to my main form, but it only
successfully searches the main form. When I click a field in the subform,
and click Find, it does not find anything in the database, although I know
it is there. Please help!!!!
 

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