Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: Access Forms FAQ

Form Basics

How do I Sync a Main by clicking a record on a subform by DougP
Posted: 12 Jan 01

Here is a picture to look at

In order for this to work you CANNOT have any Primary keys on the table where the main form is connected to.

In the subform's On_click event put this code

Private Sub Form_Click()
    Dim SyncCriteria As String
    Dim f As Form, rs As Recordset
    'Define the from object and recordset object for the AutoCAD form
    Set f = Forms(Screen.ActiveForm.FormName)
    Set rs = f.RecordsetClone
    ' define the criteria used for the sync
    SyncCriteria = "[stock_code]='" & Me![STOCK_CODE] & "'"
    ' find the corresponding record in the Parts table
    rs.FindFirst SyncCriteria
    f.Bookmark = rs.Bookmark
End Sub

Now view the form like normal, click in the far left gray square on the subform (look at sample picture above) these gray squares are the ones with the black arrow in it.
The main form will jump to the record on the subform.

That's it.

Back to Microsoft: Access Forms FAQ Index
Back to Microsoft: Access Forms Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close