Form/Subform find record

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
 
J

Jonathan Parminter

-----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
 

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