Is there anyway to get/mimic a split form in a subform?

G

genegal

I'm using a tabbed form, with the information of a contact on one tab, and a
subform on another tab that is to be used for contact events and
interactions. Ideally, I would like this subform to work like a splitforn,
where I can select an entry in the datasheet, and have the information
dynamically updated to be displayed above the datasheet.

However, I'm aware that Access doesn't allow for splitforms in subforms
(could someone explain why?), hence why I'm asking if there is anyway in
getting or mimicing a splitform within a subform, if at all possible.

I should I go about this matter?

Thank you for your replies in advance.

Gene
 
J

Jack Leach

If you have two different subforms (a datasheet and a form view for the
details), you can use the Current event of the datasheet to filter the
records of the detail subform.

Private Sub Form_Current()
Dim sFilter As String
If Not Me.NewRecord Then
sFilter = "IDField = " & Me.IDField
Me.Parent!DetailSubControlName.Form.Filter = sFilter
Me.Parent!DetailSubControlName.Form.FilterOn = True
End If
End If


But, then there's a bit of miscellaneous handling to take care of as well.
New Records being one of them. And the intial form load being another (the
datasheet may load before the detail, and if you try to apply the detail
filter before the form is fully loaded you will get an error (method or data
member not found, I believe)). In the past I've been able to get around this
by trapping the error, and using the Tab's Change event to run the filter
procedure.

hth



--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
G

genegal

Hmm...

Well, I was thinking it through, and have decided to change the structure
from:

MainForm
SubForm1
TO:

MainForm
SubForm1
SubForm2

Seeing that the hierarchy would be different, is there the possibility of
allowing a dynamic update through this layout?

Thank you for your help.
 
J

Jack Leach

Ahhh, I see... I had originally thought you were talking about your second
scenario:

Mainform
Subform1
Subform2

My previous post was made with that setup in mind.


If you still want to enterain your first idea:

Mainform

.... you can do it almost the same way, but you will need to reference the
detail (subform2) a bit differently. Either way though, it boils down to
changing the filter on a particular subform based on a selection in a
different subform.


from the subform, to reference a different subform that is on the parent
form, use this:

Me.Parent!SubformControlName.Form.Filter = "somefilter"
Me.Parent!SubformControlName.Form.FilterOn = True

from the subform, to reference a subform that is nested in the current
subform, use this:

Me.NestedSubformControlName.Form.Filter = "SomeFilter"
Me.NestedSubformControlName.Form.FilterOn = True


You might find this link helpful for trying to figure out how to reference
certain properties in various levels of subforms:

http://www.mvps.org/access/forms/frm0031.htm


Regardless of your form layout, the basic idea to accomplish your task is to
set the filter and filteron property of your detail subform as the list
subform selection is changed.

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top