Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Going to specific record - VBA 1

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
586
GB
Hello I have a main form with 2 subforms.

When I click on a record in subform_1, I want to go to the the same record in subform_2.

Both forms are tied to the same table.

The unique ID is called Prop_ID.

I can find information on going to the last record etc, but not how to go the the specific record (in this instance for example Prop_id 15).

Code:
 me.Parent.subform2.setfocus
        Docmd.Gotorecord acDataForm, me.Parent.subform2, acgoto, me.prop_id

Thanks for any help or rethink of process.

Regards

Mark
 
If I am remembering everything right, something like below ought to do it. As a side note, you likely will have problems with record locking if you are editing this data.

Code:
Dim rs as DAO.recordset 
dim frm as form
Set frm = Me.Parent.subform2.form
Set RS = frm.recordsetclone
RS.Findfirst "prop_id  = " & Me.Prop_id
If not rs.nomatch Then
    frm.bookmark = rs.bookmark
End if
 
Hello I ended up using the following which works fine.

Thank you for your help.

Mark

Code:
Me.Parent!frmSub_SA_Media_Property_Title_List.Form.Recordset.FindFirst "MediaProperty_ID=" & Me.MediaProperty_ID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top