Form/Subform find record

  • Thread starter Thread starter Vicki
  • Start date Start date
V

Vicki

I have a form with data for equipment, each piece of
equipment is a different record. Within that form is a
subform that is a summary of the equipment. (has all
records listed in datasheet view)

This is what I need to happen:

Upon selecting the record in the subform, the main form
finds that record, and when moving to a new record in the
main form, the corresponding record is selected in the
subform. This way the same record is selected at all
times, but all records are available to move through.

This has to be possible, I just haven't figured out how to
accomplish it yet.

Could some one please help, or give me some hints in case
I can't find the answer on my own.

Thanks,

Vicki
 
-----Original Message-----
I have a form with data for equipment, each piece of
equipment is a different record. Within that form is a
subform that is a summary of the equipment. (has all
records listed in datasheet view)

This is what I need to happen:

Upon selecting the record in the subform, the main form
finds that record, and when moving to a new record in the
main form, the corresponding record is selected in the
subform. This way the same record is selected at all
times, but all records are available to move through.

This has to be possible, I just haven't figured out how to
accomplish it yet.

Could some one please help, or give me some hints in case
I can't find the answer on my own.

Thanks,

Vicki
.
Hi Vicki, your idea sounds fun...

you need to ensure that the subform contains a field that
references a record in the main form and vice versa.

Use the Form_OnClick event to trigger the following code
example...

***** code start*****

dim frm as form

set frm=subformcontrol.form
frm.recordsetclone.findfirst "[RecordID]=" & txtRecordID
frm.bookmark=frmrecordsetclone.bookmark

set frm=nothing

***** code end ******

replace subformcontrol with name of control in main form
that contains the subform. Or, for the subform, replace
subformcontrol with the name of the main form.

replace recordid with the field name that you are using
for the search

Keep in mind that if you do use the form_OnClick event to
run this code, it will run every form click. You may want
to assign code to an appropriate button or an event of a
single control per form.

Luck
Jonathan
 
Back
Top