Emulated split form problem (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
No idea without seeing your db
The highlight is a nice touch but hardly crucial

Did you use version 5?
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Hi

Version 6 attached

I THINK I've fixed the errors so it can be edited in both halves of the form without error
Please check if it works for you

There's probably some code I can remove but first I'd like to know if its OK
 

Attachments

  • EmulateSplitForm v6.accdb
    576 KB · Views: 135

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
I looked at V3 as it works fine in that version.
V5 appears to be the same.
Definitely due to the Recalc. I commented out yours in V3 and V5 it does the same. No idea as to why my Access hangs if that is in the current event.:banghead:

No big deal, it is just I have changed the ESF (emulated split form) to a Continuous form now and that feature emphasizes it better.

Re V3 & V5. If you try sort on the ESF using the column headers when a datasheet, that breaks the synchronisation.

I've just seen V6 and downloaded that. After a few clicks in the ESF I get 'You cannot go to that record' and then have to close Access. You'd probably find a way around that, but I tried Ctrl & Break with no success.

No idea without seeing your db
The highlight is a nice touch but hardly crucial

Did you use version 5?
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
I'm out for most of today but I'll get back to it later.
It may be that removing duplicated code would fix it.

I think I know why you got the 'can't go to that record error'
Were you by any chance on the last record?

I changed it to a datasheet as I thought you were having problems with a continuous form. Happy to change it back

Not sure I understand what you're saying is fine in the first part of your post

Do bear in mind that I NEVER use split forms and that applies to this one as well.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
Colin,

I still get the cancel/Update error if I try and edit in the subform
I also get the Unable to go to record error just on a random record selected (perhaps 4th in the list) with the code
DoCmd.GoToRecord , , acNext

I then have to close Access as I cannot get back to the form, even after reset.
However I do have the message 'This database uses features..." as I only have 2007 SP3

I am going to use the ESF as a quick record locater for the main form, as it is ideal for that and allows you to only show the controls you want, whereas the splitform insists on all the controls. Each has it uses. Due to the sort problem if a datasheet, I will also use as Continuous Form, so that is my introduction to those as well. :D
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
What worked fine was the row highlighting in the earlier V3 version, so I looked at that version for how you enabled the row highlighting.

I'm out for most of today but I'll get back to it later.
It may be that removing duplicated code would fix it.

I think I know why you got the 'can't go to that record error'
Were you by any chance on the last record?

I changed it to a datasheet as I thought you were having problems with a continuous form. Happy to change it back

Not sure I understand what you're saying is fine in the first part of your post

Do bear in mind that I NEVER use split forms and that applies to this one as well.
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Hi again

Its chucking it down outside so I'm back at my computer

Yet another version attached - v7 - hopefully the final one
The recordset error is hopefully now sorted

Changes made:
a) A couple of event codes got 'detached' from the controls in v6 - FIXED
b) The subform got moved into the form detail section by mistake - should be in footer - FIXED
c) Highlighting code should still have worked as I haven't altered it since v3
d) Subform now a continuous form again which it was originally.
This means you can no longer sort by column headers as in a datasheet
I do have code to allow sorting by column in a continuous form but not done here as it's a separate issue
e) I've disabled adding/deleting records though editing is allowed

Cross fingers you won't find anything wrong this time! :D
 

Attachments

  • EmulateSplitForm v7.accdb
    596 KB · Views: 150

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
I'm sorry to report that I still get the Update or Cancel Update error when trying to edit in the subform. :(

Not sure if that is because I am using 2007?

The good news is that the row highlighting works in my SSAFA DB, perhaps that because it is an mdb file not the accdb files I create in work, merely as it started life in Access 2003.

I found as well that Me.Refresh works for the highlighting as well as Me.Recalc.

This ESF is going to be extremely useful for the future.

Thank you for all your work on this.
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Thanks for the feedback
I suggest you use the LOCKED subform from v5 with the main form from v7.
Sort of mix n' match or pick n' mix ... remember Woolworths?

Please can I ask for more feedback from others especially those using different versions of Access. It was created in A2010.

Will update in sample databases when I have a consensus (even if I end up putting 2 versions there (v5 & v7)

I'm not sure I can do anything more with the ESF as Gasman is calling it...
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
Just an update re the Update or CancelUpdate without AddNew or Edit error message

I am getting this message sometimes on a basic split form, so perhaps nothing to do with the emulated split form?
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:38
Joined
Sep 21, 2011
Messages
14,238
Hmm, some nice touches there.
The only thing I see that I would not like happening is the record count always shows 1 of 1 for the main form, but I am going to study it when I have time as there is some stuff there I would like to learn and use.

Thank you.
 
Last edited:

static

Registered User.
Local time
Today, 22:38
Joined
Nov 2, 2015
Messages
823
Good spot. That's because nav buttons on the sub are turned off, but I didn't turn them on the container form ;) Should be the other way around.

I got an error when sorting the continuous form. Dunno what's causing that.
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Hi static

Thanks for doing this

I like this updated version - glad I hadn't posted version 5 or 7 to sample databases yet.

I've called this version 8 & made a couple of minor tweaks to it - mainly cosmetic
a) enlarged the overall form as it wasn't displaying properly on my screen
b) altered the size of each part to make the continuous form section larger
c) fixed the record counter for both halves of the form
d) changed the datasheet back to a continuous form - it works equally well with each (but see below)
e) re-enabled the Exit button code

I know why you get the error when you try & sort the datasheet version of the subform (referencing frmArchivedClasses) but can't at the moment see how to fix it properly.

At first I 'fixed' it by disabling the shortcut menu so it can't be sorted.
Changing it to a continuous form (which I personally prefer) had the same effect.
Hopefully a better fix can be devised

I often add sorting code to each label in the header section of a continuous form. I don't know whether its possible to do that to allow sorting without error in this case. I had a quick attempt but it caused errors

The only other thing I'd like back is the highlighter row in the continuous form or datasheet.

Anyway I definitely think this is worth taking further.
Do you want to look into the sorting & if possible the highlighting?
 

Attachments

  • EmulateSplitForm v8.accdb
    620 KB · Views: 185

static

Registered User.
Local time
Today, 22:38
Joined
Nov 2, 2015
Messages
823
So I guess sorting recreates the recordset and essentially orphans the 'clone'.
Trap the error and reassign the new rs.

Code:
Dim WithEvents f As Form

Private Sub Form_Load()
    Child1.SourceObject = "frmArchivedClasses"
    Child2.SourceObject = "fsubArchivedClasses"
    Set Child2.Form.Recordset = Child1.Form.Recordset
    Set f = Child2.Form
	...
	
Private Sub f_Error(DataErr As Integer, Response As Integer)
    Select Case DataErr
        Case 2450: Child2_Exit 0
    End Select
    Response = acDataErrContinue
End Sub
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Code:
I'd already tried something similar but it didn't help

Just tried adding your code to frmSplitter but still get the same error when sorting subform as datasheet:



Did it work for you?

UPDATE:
Just added 1 line to your code to check if its picking up the error:

Code:
Private Sub f_Error(DataErr As Integer, Response As Integer)

    MsgBox "Error " & Err.Number & " in f_Error procedure: " & Err.Description
    
    Select Case DataErr
        Case 2450: Child2_Exit 0
        Case Else
    End Select
    Response = acDataErrContinue
    
End Sub

The message box doesn't appear so this isn't the solution
 

Attachments

  • Capture.PNG
    Capture.PNG
    8 KB · Views: 405
Last edited:

static

Registered User.
Local time
Today, 22:38
Joined
Nov 2, 2015
Messages
823
Works fine here.
make sure set f = is after the other bits of code.

All code is in frmSplitter.
It's bad enough having three forms. If you wanted more split forms you wouldn't want to create a container for each so all splitter related code should be kept in that one form. You could then create new instances of it and switch the source objects. Would be nice to be able to switch views after opening then you'd only need one form and the container.
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
Works fine here.
make sure set f = is after the other bits of code.

All code is in frmSplitter.
It's bad enough having three forms. If you wanted more split forms you wouldn't want to create a container for each so all splitter related code should be kept in that one form. You could then create new instances of it and switch the source objects. Would be nice to be able to switch views after opening then you'd only need one form and the container.

I put Set f = Child2.Form exactly where you put it in your post
I know its error 2450 but can't actually get the error message box I added to appear

I agree with your comments about having 3 forms.
Unless the error I showed in the screengrab can be reliably fixed, I think your solution doesn't actually help after all. If so that's a pity

I've gone back to my version 7, changed the subform back to a datasheet to allow sorting. It works perfectly for me - no errors. Version 7A attached
 

Attachments

  • EmulateSplitForm v7A.accdb
    664 KB · Views: 168

static

Registered User.
Local time
Today, 22:38
Joined
Nov 2, 2015
Messages
823
I can't get it to work now either. :rolleyes:
I must've cocked something up somewhere.
At least you have something you're happy with. :p
 

isladogs

MVP / VIP
Local time
Today, 22:38
Joined
Jan 14, 2017
Messages
18,209
I can't get it to work now either. :rolleyes:
I must've cocked something up somewhere.
At least you have something you're happy with. :p

Hey - its not just me that does that - good to know! :)

I've got something that works for me BUT as I've said earlier in this thread, I NEVER use split forms nor do I use 'my' emulated version.
I started developing it based on an idea by MarkK & purely as a coding challenge.

Anyway, I'll wait for Gasman to test my version 7A when he has time.
If it seems OK, I'll post it to sample databases.

If you could also test it, I'd be grateful
 

Users who are viewing this thread

Top Bottom