Emulating the split form (1 Viewer)

Status
Not open for further replies.

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
Like many users of this forum, I abandoned split forms a long time ago as I found them difficult to adapt if you want to modify them in any way

In a recent thread another user wanted to keep the idea but to emulate it using a single form with a continuous subform. See this thread:
https://www.access-programmers.co.uk/forums/showthread.php?t=293854

I referred him to this post by @speakers_86.
https://www.access-programmers.co.uk/forums/showthread.php?t=284896
This works but the OP found the code quite complex.

A MUCH simpler solution was then provided by @MarkK and he has given permission for me to publish it to the sample databases area.

I can't take any credit for the code which needs just 4 lines in the Form_Open event of the main form:

Code:
Private Sub Form_Open(Cancel As Integer)
'   This is the main form open event handler
    Me.RecordSource = "tTestData"            'set the recordsource of the main form
    Me.sfm.SourceObject = "fTestDataDS"      'load datasheet subform w/ blank RecordSource
    Set Me.sfm.Form.Recordset = Me.Recordset 'set subform recordset to same object as main form's
End Sub
NOTE:
Make sure that you DON'T link parent & child fields for the form & subform

As an example, I've created a very simple db to show how it works.
The emulated split form frmForumPosts opens when you run the db

For comparison, it also contains a 'real' split form : frmForumPostsStandardSplitForm

NOTE:
As the title implies, I created the example db 'ForumPostReference' in order to save a record of forum posts at AWF, UA etc so I can refer back to them in the future.

Ideally I'd just save the details of my subscribed threads as a CSV file but that's not currently available (though you can do that for private messages!)

I'm going to add that as a site suggestion ....
 

Attachments

Last edited:

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
Attached is an updated version of the emulated split form database.

This includes code to highlight the selected row in the continuous form section.



Many thanks to @arnelgp for coming up with a simple solution to the challenge of coding this in response to the question posed in this thread
https://www.access-programmers.co.uk/forums/showthread.php?t=295085

EDIT:
With older version of the standard split forms, it was impossible to hide selected columns in the datasheet section of the form
With the emulated split form, that isn't a problem

EDIT 2 04/04/2020
In Access 2016/365, you can now hide selected columns in the datasheet part of the standard split form
 

Attachments

Last edited:

NauticalGent

CopyPaster of the First Order
Local time
Today, 16:10
Joined
Apr 27, 2015
Messages
2,857
Kudos to @Ridders, @MarkK and @Arnelgp for this very practical and useful post. I can on plagiarizing the bit to the highest level of plagiariztivity...
 

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
Some significant problems have been reported with the emulated split form.
AFAIK the problems only affect Access 2007 users.

See this rather lengthy thread: https://www.access-programmers.co.uk/forums/showthread.php?t=295803

In an attempt to deal with the reported issues, various changes have been made and alternative approaches suggested.
Version changelog attached for anyone who is interested

It seems to be impossible to create one version of the ESF that includes all features and works in all versions of Access.
Perhaps that is why the official MS split form itself has flaws....!

Anyway, attached to this are 2 versions as follows
These look very similar & mostly behave in the same way.
Please use/adapt whichever you prefer or works best for you



Version 10A
Based on the original idea suggested by MarkK using a subform and linked recordsets
This uses a continuous subform - a datasheet version is also supplied as an alternative if preferred
Either version of the subform can be sorted by clicking on any of the column headers
Includes current record highlighting and record filtering.

Issues
Updating the checkbox requires two clicks when moving to a new record
Errors reported for at least one A2007 user
Occasionally triggers error 2105 if next or previous button clicked repeatedly very fast


Version 10S
Based on a different approach suggested by Static
All controls in the same form so no need for linked recordsets
MUCH simpler code than version 10A so easier to adapt by others
This SHOULD work in ANY version of Access AFAIK
Sorting and record filtering as for version 10A

Issues:
Record highlighting removed as it didn't work properly
Same error 2105 issue can occur as for version 10A

NOTE: Full error trapping code has not been done in either version

Many thanks to others who've conributed to this topic
Particular thanks to MarkK, arnelgp & Static for their suggestions & to Gasman for providing feedback on A2007

I am intending this to be my final contribution to this topic.
However, I would be only too pleased for others to take this on and develop the idea further ....

Personally I NEVER use split forms - and that also applies to the emulated version!!!! :D
 

Attachments

Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
5,761
Thank you for all your hard work Colin.
I will certainly be using what I now call an ESF more in the future, especially for the sort feature that is available.
 

static

Registered User.
Local time
Today, 15:10
Joined
Nov 2, 2015
Messages
823
So, I decided to have a look at record highlighting. (mostly because I never used conditional formatting before and wanted to know how it was done.)

The highlight is a single locked textbox.
It uses similar conditional formatting as the other versions, except the condition value comes from a hidden textbox in the header.

I believe I also fixed the 2105 error by using movenext on the recordset instead of gotorecord.

View attachment EmulateSplitForm v10S.accdb
 

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
Apologies for the time its taken to respond to this post.
First of all it disappeared into moderator limbo for a few weeks and for some reason , it doesn't show the number of downloads.

BUT I think you've nailed it. Well done.
I tried to break it and am pleased to say I failed.
It all seems to work flawlessly

A very minor quibble is that if you click on a field on the highlighted record, the highlight changes colour but you could say that's a good thing anyway.

Job done. Why haven't others been on here to thank you?
 
Last edited:

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
One of our newest members, santifrichi, contracted me a few days ago with an enhancement to the emulated split form.
The idea was to allow users to switch between 3 modes: split form / datasheet only / single form only (see attached screenshots)

I thought it was a useful improvement and have attached my version of this
The 3 modes are selected using the buttons in the form header

Santifrichi
has done the same thing using a class module and that will be ready for posting in the next day or so.
The advantage of the class module approach done by my colleague is of course transferability of code

We've agreed to post both versions so members can compare/contrast the code and choose whichever they prefer.

Hope the new version is useful to some of you

Many thanks to santifrichi for this suggestion

EDIT - Updated to v11B 09/02/2019
Bug fixes related to record count & navigation buttons on filtering records.
Those bugs had been present since v10 and before!
 

Attachments

Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
5,761
Very neat! :cool:
 
Last edited by a moderator:

isladogs

CID Moderator
Staff member
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
13,187
Thanks
I've just discovered & fixed several bugs that had been present for over a year but not picked up by any of us before today.

I've just updated the version in post #8 to version 11B. Hopefully now bug free! ;)
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom