Using a subform to go to a record on the parent form

B

Bob Waggoner

I have a parent form (FrmQSRecord) with 85 records. I have a child form
(frmQSDetail) that is linked to the parent form. Users will fill in the child
form as they click through the 85 records. The parent form is not updated,
the child form is.

I have a subform that links the two tables together in the record source and
displays all records so users can see which ones they have done (or missed).

I’d like to be able to have the users click a record in the subform and that
event loads that specific record in the parent form. The subform is a
continuous form. The recordID on the continuous form matches the recordID
that would be loaded.

What code allows me to do this? I don’t even begin to know where to look for
help.

tblQSRecord Contains RecordID
tblQSDetail Contains RecordID as foreign key

Parent form = tblQSRecord
Child form = tblQSDetail

Continuous subform = tblQSRecord + tblQsDetail
 
D

Dale Fye

Bob,

You could do something like the following:

1. Add a GoToRecord button in the footer of the subform. I'll assume that
this is what you are going to do, but you could also do this in the
DoubleClick event of a textbox in one of the controls in the subform.

2. Then write code similar to the following:

Private Sub cmd_GoToRecord_Click

Dim strCriteria as string
Dim rs as DAO.Recordset

strCriteria = "[RecordID] = " & me.RecordID
set rs = me.parent.recordsetclone

rs.findfirst strCriteria
if rs.nomatch then
msgbox "No match found"
else
me.parent.bookmark = rs.bookmark
endif

rs.close
set rs = nothing

End Sub

HTH
Dale
 
B

Bob Waggoner

Dale,
Thank you for your excellent help. I was able to do exactly what I wanted to
do! This has a lot of application to my quality systems database. Thanks!!!

Dale Fye said:
Bob,

You could do something like the following:

1. Add a GoToRecord button in the footer of the subform. I'll assume that
this is what you are going to do, but you could also do this in the
DoubleClick event of a textbox in one of the controls in the subform.

2. Then write code similar to the following:

Private Sub cmd_GoToRecord_Click

Dim strCriteria as string
Dim rs as DAO.Recordset

strCriteria = "[RecordID] = " & me.RecordID
set rs = me.parent.recordsetclone

rs.findfirst strCriteria
if rs.nomatch then
msgbox "No match found"
else
me.parent.bookmark = rs.bookmark
endif

rs.close
set rs = nothing

End Sub

HTH
Dale


Bob Waggoner said:
I have a parent form (FrmQSRecord) with 85 records. I have a child form
(frmQSDetail) that is linked to the parent form. Users will fill in the
child
form as they click through the 85 records. The parent form is not updated,
the child form is.

I have a subform that links the two tables together in the record source
and
displays all records so users can see which ones they have done (or
missed).

I'd like to be able to have the users click a record in the subform and
that
event loads that specific record in the parent form. The subform is a
continuous form. The recordID on the continuous form matches the recordID
that would be loaded.

What code allows me to do this? I don't even begin to know where to look
for
help.

tblQSRecord Contains RecordID
tblQSDetail Contains RecordID as foreign key

Parent form = tblQSRecord
Child form = tblQSDetail

Continuous subform = tblQSRecord + tblQsDetail
 

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