split form inside a form

%3CLINGO-SUB%20id%3D%22lingo-sub-2062547%22%20slang%3D%22fr-FR%22%3Esplit%20form%20inside%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2062547%22%20slang%3D%22fr-FR%22%3E%3CP%3EI%20Insert%20I%20split%20form%20inside%20a%20form%20that%20have%20the%20same%20query%2C%20so%20when%20I%20click%20on%20a%20row%20on%20that%20split%20form%20the%20form%20does%20not%20%3CSPAN%3E%20change.%20is%20there%20an%20event%20or%20macro%3F%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Sans%20titre-2.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F246459i85EE6463650AB206%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Sans%20titre-2.jpg%22%20alt%3D%22Untitled-2.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2062547%22%20slang%3D%22fr-FR%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2062731%22%20slang%3D%22en-US%22%3ERe%3A%20split%20form%20inside%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2062731%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F929748%22%20target%3D%22_blank%22%3E%40soufiane91%3C%2FA%3E%26nbsp%3BIf%20it%20is%20a%20subform%20in%20a%20main%20form%2C%20then%20YOU%20have%20to%20fire%20some%20code%20to%20requery%20the%20main%20form%20and%20set%20focus%20to%20the%20record%20selected%20in%20the%20subform.%20If%20you%20do%20it%20the%20other%20way%20around%2C%20and%20if%20the%20Master%2FChild%20Linking%20fields%20are%20properly%20set%2C%20then%20selecting%20a%20record%20in%20the%20main%20form%20WILL%20requery%20the%20subform%2C%20though.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%3A%20I%20don't%20see%20a%20Split%20form%20in%20that%20screen%20shot.%20All%20I%20can%20see%20is%20a%20subform%20in%20datasheetview%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2064020%22%20slang%3D%22fr-FR%22%3ERe%3A%20split%20form%20inside%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2064020%22%20slang%3D%22fr-FR%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20I%20didn't%20explain%20clearly.%20I%20want%20to%20display%20a%20form%20and%20its%20datasheet%20%22like%20a%20split%20form%22%20but%20me%20I%20want%20a%20split%20form%20I%20want%20to%20create%20a%20form%20and%20its%20datasheet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2064436%22%20slang%3D%22en-US%22%3ERe%3A%20split%20form%20inside%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2064436%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F929748%22%20target%3D%22_blank%22%3E%40soufiane91%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20clarifying%20that.%20Because%20a%20%22Split%20Form%22%20is%20a%20very%20specific%20type%20of%20form%2C%20I%20was%20a%20bit%20confused.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I Insert I split form inside a form that have the same query , so when I click on a row on that split form the form does not change  . is there an event or macro ??

 

 Sans titre-2.jpg

4 Replies

@soufiane91 If it is a subform in a main form, then YOU have to fire some code to requery the main form and set focus to the record selected in the subform. If you do it the other way around, and if the Master/Child Linking fields are properly set, then selecting a record in the main form WILL requery the subform, though.

 

BTW: I don't see a Split form in that screen shot. All I can see is a subform in datasheetview

@George Hepworth 

maybe I didn't explain clearly . I want to Display a form and its datasheet " like a split form" but me I dont want a split form I want to create a form and its datasheet .

@soufiane91 

Thank you for clarifying that. Because a "Split Form" is a very specific type of form, I was a bit confused.

 

@soufiane91 

Let me see if I can understand the situation a bit better.

 

You have a main form bound to this query. You also have a SUBform bound to the same query.

You want to show the main form in Single Form View. You want to show the SUBform in Datasheet View. 
This is, in fact, a lot like a Split Form would work, is it not? There are some limitations to Split Forms that might make this approach more desirable. 

That said, I am not convinced this is such a good idea, so I'm going to offer an alternative and see what you think.

If the point is to use the SUBform to navigate the main form, then a List Box control bound to that same query would do the job and be considerably less work to implement. 

If there is another reason to want to have both forms, perhaps you can explain that so I can better understand how it needs to work.

As it is, I can see simply placing the following code (or something similar to it), in the Current Event of the SUBform. I'm not sure I've ever seen this done, so it's sort of a guess about how it ought to work, though. 

 

Private Sub Form_Current()

    Dim lngPrimaryKey as Long

    Dim rstParentFormRecordSource as DAO.Recordset

    lngPrimaryKey = Me.PrimaryKey

    Set rstParentFormRecordSource = Me.Parent.Form.RecordsetClone

    rstParentFormRecordSource .FindFirst "PrimaryKey = " & lngPrimaryKey

    Me.Parent.Recordsource.Bookmark = rstParentFormRecordSource.Bookmark


    Set rstParentFormRecordSource  = Nothing

 

End Sub

 

Thanks for further clarifying the goal.