Switching from a subform on one tab, to a subform on another tab, finding a record

I have a form with a tab control. One tab contains a data entry single form for delivery dispatches. Another tab contains a continuous form that lists all the dispatches for an individual location, chosen by a combo box on that form. The continuous form has an object containing the dispatch id. The single form has a hidden text box containing the dispatch id. If I'm on the continuous form, on a particular record, how can I switch to the single form, displaying the dispatch corresponding to the current record on the continuous form?

Thank you
Tom LobbAccess database developerAsked:
Who is Participating?
 
Dale FyeCommented:
Assuming your have controls:

tabMain
sfSingle
sfContinuous

And that the single form subform is not filtered based on a master child relationship to the main form,

I generally do is something like using the click event of a button on the continuous form, or the double click event of the record selector on that form:
Private Sub cmd_EditRecord_Click

    with me.parent.sfSingle.Form.RecordsetClone
        .FindFirst "DispatchID = " & me.txt_DispatchID
        if .nomatch then
            msgbox "no matching record"
        else
            me.parent.sfSingle.bookmark = .bookmark
            me.parent.tabMain = 1               'where you replace 1 with the tab page # associated with the single form.
        endif
    end with

End Sub

Open in new window

0
 
Gustav BrockCIOCommented:
Though not two continuous subforms, this article may help you:

Synchronizing Multiple Subforms in Access
0
 
Tom LobbAccess database developerAuthor Commented:
Thanks for the feedback.

The first part is working. But on the line, 'Me.Parent!frm_Dispatch.Bookmark = .Bookmark', I get the error 'Object doesn't support this property or method'. Could this be that the record source of the single form is a query, using a few tables?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Dale FyeCommented:
Try:

Me.Parent!frm_Dispatch.form.Bookmark = .Bookmark

note that i added the reference to the "form" object between the subform control name (frm_Dispatch) and the .Bookmark property.

Dale
0
 
Tom LobbAccess database developerAuthor Commented:
That did it. Thanks very much.
0
 
Dale FyeCommented:
Don't forget to close out your question.
0
 
Tom LobbAccess database developerAuthor Commented:
Thanks for the help
0
 
Dale FyeCommented:
glad to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.