Using a datasheet subform as record selector

T

Tokyo Alex

Dear all,

I have an unlinked datasheet subform which I'm using as a quick view list /
record selector for the main (detail) form. Basically I'm trying to
duplicate split form functionality, but I can't use a split form because it
destorys my formatting.

So far I have the following code:
In the subform:
With Me.Parent.RecordsetClone
.FindFirst ("daID = " & Me.daID)
If Not .NoMatch Then
Me.Parent.Recordset.Bookmark = .Bookmark
End If
End With

In the mainform:
With Me.sfcAlertSplit.Form.RecordsetClone
.FindFirst ("daID = " & Me.daID)
If Not .NoMatch Then
Me.sfcAlertSplit.Form.Recordset.Bookmark = .Bookmark
End If
End With

This works well most of the time, but it sometimes (for no reason I can
determine) gets into a fail state where it won't navigate properly.

Here's what I've figured out so far:
It won't enter the fail state if navigating in the main form.
It won't enter the fail state if I click on the datasheet's record selector.
It will enter the fail state unpredictably if I click a control in the
subform.
It will come out of the fail state if I click on the datasheet's record
selector.
It will occasionally come out of the fail state if I click a control in the
subform.
It will not come out of the fail state if I use the main form's navigation
buttons, nor will it navigate to the next record.

I put msgboxes into the procedures to test the firing order and which ID is
passed; and these are the results:
T is the target record ID and S is the source (i.e. current before
navigation) ID.
In normal state:
Main form navigation: Main (T) -> Sub (T)
Subform navigation: Sub (T) -> Main (T)

In fail state:
Mainform navigation: Main (T) -> Sub (T) -> Sub (S) -> Main (S)
Subform navigation: Sub (T) -> Sub (S) -> Main (T) -> Sub (T) -> Sub (S) ->
Main (S)

What is causing the subform's Current event to fire twice? And with the old
(no longer current) record ID the second time? Do you think that this is a
timing issue?

There's no other code in the subform; the main form has an unrelated command
button with a short procedure.

The main form does contain another, linked subform which does not have an On
Current event.

Any assistance, ideas, pointers or comments will be very much appreciated.

Thank you,
Alex.
 

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