jln via AccessMonster.com said:
Well i went qith you idea to create a table that each investor number
and a check box. Since a investor cant be audit by record, its done
as a group of records. BUt im stuck. What i have is the combobox
with each investor once and the checkbox on the main form and then on
the sub form is the records for the investor that is selected in the
combobox. That is where im having the problem How do i make it
run/rerun the query when a new investor number is changed in the
combobox?
Subform linkage via the Link Master/Child Fields will take care of that,
if you set it up right.
Let's see what you have. You have a table -- I'll assume it's called
"Investors" -- with [Inv#] as its primary key, and at least one other
field, which for the sake of example I'll call "FilesViewed".
You have another, related table that (again, for this example) I'll call
"InvestorFiles". This table will have a primary key field of its own,
miscellaneous data fields I don't know about, and the [Inv#] field to
serve as the foreign key relating it to Investors.
You need to create two forms: one bound to the Investors table to serve
as the main form, and one bound to InvestorFiles to serve as the
subform. When I say "bound to" with regard to a form, I mean that it
has the table or query I named as its RecordSource. The form bound to
InvestorFiles does not have to be bound to a query that refers to the
main form for criteria -- it can be bound directly to the table (unless
there's some other reason you need it to be a query).
The main form, as I said, will be bound to Investors. It will have at
least three controls on it before you add the subform:
cboFindInvestor (combo boxs, unbound)
chkFilesViewed (check box, bound to FilesViewed)
txtInvNo (text box, bound to [Inv#])
When I say "bound to" with regard to a control, I mean that the control
has the field I named as its ControlSource.
The main form may have other controls on it, bound to other fields (if
any) in the Investors table. You might want to have InvestorName on
there, for example.
Note that cboFindInvestor is unbound. That's because we are going to
use it for navigation among records on the main form. The RowSource of
cboFindInvestor should be a SQL statement that selects at least the
[Inv#] field from all the records in the Investors table. If you like,
you can use the Combo Box wizard to build this combo box -- just tell
the wizard you want it to "find a record on my form".
Now, having created the two forms, the main form and the form that will
appear on the main form as a subform, open the main form in design view
and drag the subform from the database window and drop it on the detail
section of the form. That will create a subform control on the main
form, with the InvestorFiles form as its source object.
Access may successfully guess at the correct values for the Link Master
Fields and Link Child Fields properties of the subform control, but you
should open the property sheet of the subform control, go to the Data
tab, and check those properties. The Link Child Fields property should
be "[Inv#]". The Link Master Fields property should be either "[Inv#]"
or "txtInvNo".
At this point, as you navigate through the records on the main form,
whether by advancing a record at a time or by using cboFindInvestor to
jump to a specific investor, you should see on the subform only the
records that are related to the current investor.