How to show search result in sub-form?

  • Thread starter hkgary33 via AccessMonster.com
  • Start date
H

hkgary33 via AccessMonster.com

Dear all,
In my database, I’ve built a main form called frmVIEW which is linked with a
sub form called sfrmDUP. In the frmVIEW, it shows one record in tbl_FileInfo
in a time (a singular form), and two important fields are included to be
shown:
1) File_No: It is the unique key that identifies each record
2) District: It shows the district taken place of each file
Since we’re particularly interest in duplicated districts, what I would like
to do is once the frmVIEW is shown, it will seek the district of current
record, and then search in the tbl_FileInfo to see whether there are other
files with same districts as the current record, and the result will be shown
in the sub form sfrmDUP simultaneously. And even I navigate to other records,
the records in sfrmDUP will be updated accordingly.
Can anyone kindly solve the above problem?

Thanks a lot!!!!

Gary
 
D

Duane Hookom

I would expect that you could set the link master/child properties of the
subform control to [District].
 
H

hkgary33 via AccessMonster.com

Dear Duane,
I’ve tried your method to link the main form and the sub form, it works so
that all duplicate districts are shown in the sub form, but it will also show
the current record too, which is not desirable. For example, if File number 1
& 4 have same district “A Town”, then if the current record shown in the main
form is File 1, then in the sub form, it shows the following records:
File No. District …
1 A Town
4 A Town

It is not desirable since File 1 is already shown in the main form, all I
would like to show is those with duplicate districts except the current file.

I’ve tried to solve it by clicking the properties of the sub-form and then in
the Filter box, I’ve typed: tblFileInfo.[File_No] <> Forms![frmMain]![File_No]

So as to try filtering out the current record, but it still doesn’t works,
what can I do to solve this problem?

Thanks so much!
Gary


Duane said:
I would expect that you could set the link master/child properties of the
subform control to [District].
Dear all,
In my database, I’ve built a main form called frmVIEW which is linked with
[quoted text clipped - 19 lines]
 
D

Duane Hookom

Set the criteria in the subform's record source.

WHERE [FileNum] <> Forms!frmYourMainForm!txtFileNum

--
Duane Hookom
MS Access MVP

hkgary33 via AccessMonster.com said:
Dear Duane,
I’ve tried your method to link the main form and the sub form, it works so
that all duplicate districts are shown in the sub form, but it will also
show
the current record too, which is not desirable. For example, if File
number 1
& 4 have same district “A Town”, then if the current record shown in the
main
form is File 1, then in the sub form, it shows the following records:
File No. District …
1 A Town
4 A Town

It is not desirable since File 1 is already shown in the main form, all I
would like to show is those with duplicate districts except the current
file.

I’ve tried to solve it by clicking the properties of the sub-form and then
in
the Filter box, I’ve typed: tblFileInfo.[File_No] <>
Forms![frmMain]![File_No]

So as to try filtering out the current record, but it still doesn’t works,
what can I do to solve this problem?

Thanks so much!
Gary


Duane said:
I would expect that you could set the link master/child properties of the
subform control to [District].
Dear all,
In my database, I’ve built a main form called frmVIEW which is linked
with
[quoted text clipped - 19 lines]
 

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