If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Using a subform to go to a record on the parent form
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 |
#2
|
|||
|
|||
Using a subform to go to a record on the parent form
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" wrote in message ... 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 |
#3
|
|||
|
|||
Using a subform to go to a record on the parent form
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" wrote: 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" wrote in message ... 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 |
Thread Tools | |
Display Modes | |
|
|